use strict; use Parallel::ForkControl; my $forker = new Parallel::ForkControl( Name => 'Test Program', MaxKids => 20, MinKids => 1, # default btw WatchCount => 1, # keep track by number WatchLoad => 1, # use '/bin/uptime' MaxLoad => 8.0, Code => \&getStats # child subroutine ); my @hosts = map { $_ = qq/host$_/; } (1..400); foreach my $host (@hosts) { $forker->run($host); } $forker->cleanup(); sub getStats { # code me as a regular subroutine with return # at the end, or don't, it doesn't matter # anything happening in here will be the child my $host = shift; ........ return 1; }