in reply to Re: Re: getting a child's process ID
in thread getting a child's process ID

Looks to me like that should work as you want. Here's what I did to test it out:

#!/usr/bin/perl -w # parent.pl use strict; if (my $pid = fork) { print "parent: child pid is $pid\n"; } else { exec('./child.pl'); } #!/usr/bin/perl -w # child.pl use strict; print "Child: pid is $$\n";

And the output I got was:

parent: child pid is 26534 Child: pid is 26534
--
<http://www.dave.org.uk>

"The first rule of Perl club is you don't talk about Perl club."

Replies are listed 'Best First'.
Re: Re: Re: Re: getting a child's process ID
by Seshouan (Acolyte) on Oct 19, 2001 at 22:33 UTC
    your exemple would work for Unix systems, but not for win32. Using what you gave me, the child reports the accurate PID, but the parent reports something totally different. Thanks though.