my $pm = new Parallel::ForkManager(10); for my $count (1..10) { $pm->start and next; # do the fork sub1($count,$lines,\@cna); $pm->finish; # do the exit in the child process } $pm->wait_all_children;