my $child; unless($child = fork()) { open (FH, "$statusfile") or die "Unable to open file: $!"; my $DELAY = 5; for(;;) { while() { print; } sleep $DELAY; seek(FH, 0, 1); } } # continue with main program kill(15, $child); #when you want it to stop