in reply to Function to get a child pid

If the child process was started by the parent process in Perl, then you could find the child's pid simply by
my $pid = fork(); if (!defined($pid)) { print "Could not fork!\n"; } elsif ($pid) { print " child pid was $pid\n"; } else { print "I am the child\n"; }