use warnings; use strict; print "Start of script\n"; foreach(1..200) { run_sleep($_); } print "End of script\n"; sub run_sleep { my $i = shift; my $pid = fork; return if $pid; # in the parent process print $i." - Running child process\n"; foreach(1..2){ print $i." - ".$_."\n"; select undef, undef, undef, 1; } print $i." - Done with child process\n"; exit; # end child process }