consider this fragment:
Youll see that the $ttyport is not a global variable,
each fork call gets its own copy, so its gonna loop more than
expected.
#!/usr/bin/perl
use POSIX;
for($i = 0; $i < 10; $i++){
$pid = fork();
if($pid){
$ppid = getppid();
print "$ppid\n" unless $ppid == 1;
}
}
coding101
Junior Poster in Training
74 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0