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.
In reply to Re: Parallel::ForkManager question
by ikegami
in thread Parallel::ForkManager question
by icanwin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |