more useful options | |
PerlMonks |
Re: how come both the if and elsif block getting executed ?by zentara (Archbishop) |
on Apr 20, 2014 at 17:50 UTC ( [id://1082955]=note: print w/replies, xml ) | Need Help?? |
You know, I never really questioned the syntax, but from my limited experience, it is a way actually executing the fork. The if($pid) part is true, if the system can fork and return a non-zero pid. So the fork occurs and the parent gets a pid, and the child receives a 0. It is the c way of forking. So both sections of code get executed, but one is in the parent and the other is the child.
I'm not really a human, but I play one on earth. Old Perl Programmer Haiku ................... flash japh
In Section
Seekers of Perl Wisdom
|
|