my $output = `echo hello`; # Output contains "hello" if (WIFEXITED($?)) { print("Command exited with status " . WEXITSTATUS($?)); } else { print("Command exited abnormally"); # If desired, use the other macros to figure out which # signal killed the process. }