i am trying to teach myself perl and network programming with perl and i am unsure of what the problem is with the following code:
#!/usr/local/bin/perl
print "PID=$$\n";
my $child = fork();
die "cant 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";
}
i know its not much but the code is copied fom a book, the thing is it should work and its giving me a headache. i have windows XP pro and running perl 5.6
thanx in advance
#!/usr/local/bin/perl
print "PID=$$\n";
my $child = fork();
die "cant 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";
}
i know its not much but the code is copied fom a book, the thing is it should work and its giving me a headache. i have windows XP pro and running perl 5.6
thanx in advance