You could replace all your code with:
$|++; sleep 5 if -s $logfile;
This code gets your program to sleep for 5 seconds unless $logfile has a non zero size (-s filetest). You don't need to open a file and check its contents is not blank. If this is the case it will have a size greater than zero. For the filetest operators see perlman:perlfunc:alphabetical and look for -X. The $|++ will flush the buffers. The code if (@file != "") is the same as if (@file) BTW
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Do-nothing loops
by tachyon
in thread Do-nothing loops
by Wassercrats
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |