#### $!=0; system('your_program_goes_here'); my $child_error=$? & 0xff; my $maybe_exit_code=$? >> 8; if($child_error || ($maybe_exit_code && $!)) { # there was an error in program execution }