# We have some jobs which take some time... @Cmds = ('curl "http://www.perlmonks.org/?node=Newest%20Nodes"', 'fsck -n /', './calculate_high_accurate_pi'); # Let's start them... my @PIDs; my $Tempfile = '/tmp/job_controller.'.$$; for (0..$#Cmds) { $PIDs[$_] = `$Cmds[$_] >$Tempfile.$_ 2>&1 & echo $!`; } # Ok, they all are running now while (kill 0,@PIDs) { sleep 1; } for (0..$#Cmds) { open my $TmpFH,$Tempfile.'.'.$_; print "----- $Cmds[$_] returned: -----\n". join('',<$TmpFH>); close $TmpFH; unlink $Tempfile.'.'.$_; } print "Everthing done!\n";