On 10/29/07, Ryan Dillinger <[EMAIL PROTECTED]> wrote: > > #!/usr/bin/perluse warnings;use strict; > > print "PID=$$\n"; > my $child = fork();die "Can't fork: $!" unless defined $child; > if ($child > 0) { # parent process print "Parent process: PID=$$, > child=$child\n";} else { # child process my $ppid = getppid(); print > "Child process: PID=$$, parent=$ppid\n";} >
Hi, I think you want to see the parent id and child id when forking. The modification version of your code is below, #!/usr/bin/perl use warnings; use strict; my $pid = $$; print "process id before forking is ",$pid,"\n"; #print "PID=$$\n"; # don use something like this,what is it? my $child = fork(); die "Can't fork: $!" unless defined $child; if ($child > 0) { # parent process print "parent id is ",$$,"\n"; }else { # child process my $ppid = getppid(); print "Child id is $$, parent id is $ppid\n"; } __END__ HTH. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/