# ... setup code my $NUM_CHILDREN = 10; my $total_count; my @pids; for (my $i = 0; $i < $NUM_CHILDREN; $i++) { $pids[$i] = open(CHILD, "-|"); if ($pids[$i]) { next; } elsif (defined $pid) { # child handler, $pid=0 my $count = 0; my $done = 0; while (!$done) { # make web request; set $done somewhere $count++; } } else { die "Fork failed at number $i: $!\n"; } }