You can use getppid() inside the kid process to get the process ID of the parent if neccessary.print "My PID is $$\n"; my $child = fork(); # at this point, two scripts are executing simultaneously # fork spawns a new copy of the script, and returns the # process id of the parent to the parent, and 0 to the child if ($child > 0) { # this is the original (the parent) print "Hello Parent (PID is $$)\n"; } else { # this is the forked copy (the child) print "Hello Kid (PID is $$)\n"; }
Hope this helps
jeffa
In reply to (jeffa) Re: Forked off!
by jeffa
in thread Forked off!
by larryk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |