in reply to Reading a file live!

At least on Unix and Unix-like systems, it seems to me that your master script should not be blocked. This is a quick test. First, the subprogram, which is turning off IO buffering and writing a number every 3 seconds:

# sub_program use strict; use warnings; { my $fh = select STDOUT; # making STDOUT "hot" (no IO buffering) $| = 1; select $fh; } for my $i (0..100) { print "$i \n"; sleep 3; }
Now the master program, which is reading every 10 seconds the full file produced by the subprogram and prints out the last line:
# main program use strict; use warnings; system ("perl sub_program.pl > file.txt &"); my $last_line; for my $i (0..100) { sleep 10; local @ARGV = ("file.txt"); $last_line = $_ while <>; print "iteration $i : $last_line"; }
Now running the master program:
$ perl test_sub.pl iteration 0 : 3 iteration 1 : 6 iteration 2 : 9 iteration 3 : 13 iteration 4 : 16 ...
As you can see, the master program ("test_sub.pl") is perfectly able to read the file generated by the subprogram, even though the subprogram is still running. Maybe your problem is that you did not think about turning off IO buffering.