sub reaper { 1 until (-1 == waitpid(-1, WNOHANG)); } $SIG{CHLD} = \&reaper; kill 9, $childPid; # signal the child to die reaper(); # IMPORTANT! ...wait for the child to go away # (else we might get perl seg faulting on exit) exit; # and die ourselves