in reply to Re: Windows weirdness after fork, dup2
in thread Windows weirdness after fork, dup2
The = in that line is the assignment of the return value from fork to the variable $f. fork returns undef if it fails, 0 in the child, and the child's PID in the parent. So if the fork fails, there's only one process, and it die's. Otherwise, the child starts executing inside the elsif (!$f) block, and the parent executes the rest of the program. You can see this by having the different chunks of code print out PIDs.
Plus, it works under Unix, which indicates that the code is generally correct.
|
|---|