use strict; use warnings; my @isolist = qw(one two three four five); # should contain ISO names while (my @workunit = splice @isolist, 0, 3) { my @pids; for (0 .. $#workunit) { push @pids, burncd($workunit[$_], $_); } waitpid $_, 0 for @pids; print "Work unit finished.\n"; if (@isolist) { # perhaps a prompt here to put in new blanks print "Starting next round...\n"; sleep 3; } } sub burncd { my ($isoname, $target) = @_; my $pid = fork; die "Cannot fork: $!" unless defined $pid; return $pid if $pid; print "Burning $isoname to cdrw$target\n"; # burn the cd. randomized sleep just for testing. sleep int rand(5) + 5; exit; }