in reply to spawning Perl scripts

Just to add another way to do this, I have used Parallel::Forkmanager for several scripts that needed to run forked processes. One feature I really appreciate is the ability to limit the number of processes started.

Here is an example from the DOCs for your convienance.

  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
  }