- or download this
# sub_program
use strict;
...
print "$i \n";
sleep 3;
}
- or download this
# main program
use strict;
...
$last_line = $_ while <>;
print "iteration $i : $last_line";
}
- or download this
$ perl test_sub.pl
iteration 0 : 3
...
iteration 3 : 13
iteration 4 : 16
...