cat fatals.pl #!/usr/bin/perl use strict; use warnings FATAL => 'all'; my $cmd = shift || '_bad_exe_ a b c'; print "I'm parent with id $$\n"; eval { my $pid = open CMD, "-|"; if ($pid) { print "I'm forking a child with id $pid\n"; print while ; } else { #no warnings; # get rid of warnings on "Can't exec:..." print "[$$] I'm child, about to exec [$cmd]\n"; exec $cmd; } }; die "[$$] ERROR: $@" if $@; print "[$$]HOW DID I GET HERE?\n"; #### $ perl fatals.pl ls I'm parent with id 6238 I'm forking a child with id 6239 [6239] I'm child, about to exec [ls] 642663.pl 642676.pl 642682.pl 644761.pl #### $ perl fatals.pl I'm parent with id 6240 [6241] ERROR: Can't exec "_bad_exe_": No such file or directory at fatals.pl line 18. I'm forking a child with id 6241 [6241] I'm child, about to exec [_bad_exe_ a b c] [6240]HOW DID I GET HERE?