my $pid = fork(); die "Can't fork() : $!\n" unless defined $pid; if ($pid){ if (waitpid($pid, 0) > 0); my ($rc, $sig, $core) = ($? >> 8, $? & 127, $? & 128); if ($core){ print "$pid dumped core\n"; }elsif($sig == 9){ print "$pid was murdered!\n"; }else{ print "$pid returned $rc"; print ($sig?" after receiving signal $sig":"\n"); } }else{ print "$pid... um... disappeared...\n"; } }else{ unless (run_code()){ exit 1; } exit 0; }