in reply to Parallel::ForkManager question

You want to know the child's PID in the child? $$.
You want to know the parent's PID in the child? Just store $$ into a variable (say $ppid) before the loop.
You want to know the child's PID in the parent? Use the snippet below.

for (...) { my $pid = $pm->start; if ($pid) { # We're in the parent. ...[ do something with $pid ]... next; } # We're in the child. ... }

Update: Added third question and answer.