use warnings; my $file = shift; my $numcopies = shift; my $numchildren = 10; my $load = ($numcopies/$numchildren); my $count = 0; my $pid; for(1..$numchildren) { for(1..$load) { $pid = fork(); die "Cannot fork: $!" if (! defined $pid); if (! $pid) { exec ("cp '$file' '$count'.file"); die "Could not exec: !\$"; } $count++; } }