http://qs321.pair.com?node_id=175894


in reply to Many children, but never more than a fixed number at once.

I find Parallel::ForkManager good for this kind of thing as it lets you write:
use Parallel::ForkManager; $pm = new Parallel::ForkManager($MAX_PROCESSES); foreach $data (@all_data) { # Forks and returns the pid for the child: my $pid = $pm->start and next; ... do some work with $data in the child process ... $pm->finish; # Terminates the child process }
Code stolen from docs :)

gav^