BEGIN { *CORE::GLOBAL::system = sub { if ( 0 == CORE::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; }; } system(qw(perl -u -e 1)) or die "$@\n";