Unix (flavours; don't know what Windows does): Additionally, you might want to catch or ignore the SIGCHLD-signal that the parent process receives when the child process dies. If there is only one child process, a
$SIG{CHLD} = sub { wait(); }; as described in
perlipc can be used as a starter. This should protect the parent process in case the child process dies while the parent process has not yet reached
wait() (race situation).
Update: Well, after some testing, this seems to be an issue with older versions of perl and OS. The default SIGCHLD-handler of Perl 5.8.8 (Linux) works fine. Anyway, the SIG-handler might be useful if you are interested in an asynchronous notification of a child's decease.