wrap_system(qw(perl -u -e 1)) or die "$@\n" #perl exited with status 0 after receiving signal 6 (core dumped) #### sub wrap_system { if ( 0 == system { $_[0] } @_ ) { return 1 } if ( -1 == $? ) { $@ = "Unable to launch $_[0]: $!" } else { $@ = "$_[0] exited with status " . ($? >> 8); if (my $sig = $? & 127) { $@ .= " after receiving signal $sig" } if ($? & 128) {$@ .= " (core dumped)" } } return; }