this is easily the most useful perl module i’ve found in recent history: Parallel::ForkManager. doing something in parallel without the overhead of actually writing really multithreaded code is quite cool.
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;
work goes here
$pm->finish; # Terminates the child process
}
highly inelegant and hardly clean, but damn this is useful.