>>720
多少の遅延が許されるなら
while(!do{ open my $fh,">",$flagfile; close $fh; }) {}
の直後にsleep関数かませばよくね?