http://www.perlmonks.org?node_id=998111


in reply to Strange (for me) behavior of Parallel::ForkManager

$manager->finish(\&next); is exit(\&next). Aside from the fact that the argument makes no sense, you're exiting the child at the wrong spot. When that child is done processing a line, it needs to exit by calling finish.

use Parallel::ForkManager; my $manager = new Parallel::ForkManager( 20 ); while (<LIST>){ $manager->start and next; my (..., $ip, ...) = split( /\s+/, $_ ); print "ip ? $ip\n"; $manager->finish() if !$p->ping($ip); ... $manager->finish(); } print "flag\n";