. . . while(1) { while(my $line=<$fh>) { # lot's o processing } sleep 5; }