use Parallel::ForkManager; my $pm = new Parallel::ForkManager(10); foreach (1..10) { # Forks and returns the pid for the child: my $pid = $pm->start and next; &something_1(); $pm->finish; # Terminates the child process } $pm->wait_all_children;