#!shebang use strict; use warnings; # do ...; # (whatever sets up the call) call executable # (using system, exec, backticks or ....); # First time check for file written by executable if (exists $thefile) { # the file_in_line_13) { readit(); } else { sleep (some amount of time); goto (in some form or another) 18; } sub readit { open '<', EXEOUT, $thefile ; $latest = ; close EXEOUT; print "$latest \n"; # (to user); recheck(); } sub recheck { my $timesIdential = 1; sleep (time); open '<', EXEOUT, $thefile ; $newlatest = ; if ( $newlatest ne $latest ) { clearscreen (OS dependant); readit(); } else { $timesIdentical++; if ($timesIdentical = n) { # for some "n" sufficient to convince you # that the executable is done clearscreen; print "Done\n\n" . $newlatest . "\n"; exit(); } } }