system('some_shell_command') >> 8 and die "Failed!"; # or else (same thing), system('some_program'); if ($? >> 8 != 0) { die "Failed!"; }