#!/usr/bin/perl --
use strict;
use warnings;
use Parallel::ForkManager;
my $pm = new Parallel::ForkManager(3);
for my $data ( 0 .. 2 ){
my $pid = $pm->start and next; ## WITH NEXT
# my $pid = $pm->start ; ## WITHOUT NEXT
print "data ($data) pid ($pid) \$\$($$)\n";
$pm->finish; # Terminates the child process
}
__END__
####
data (0) pid (0) $$(-1792)
data (1) pid (0) $$(-1856)
data (2) pid (0) $$(-1916)
####
data (0) pid (-1944) $$(1992)
data (1) pid (-1656) $$(1992)
data (1) pid (0) $$(-1656)
data (0) pid (0) $$(-1944)
data (2) pid (-1924) $$(1992)
data (2) pid (0) $$(-1924)