#!/usr/bin/perl # # Dummy of outer perl script that is calling shell script # use strict; use warnings; # You could use $? later instead of defining $return my $return = system("./shell_script.sh"); if ($return == -1) { print "failed to execute: $!\n"; } elsif ($return & 127) { printf "child died with signal %d, %s coredump\n", ($return & 127), ($return & 128) ? 'with' : 'without'; } else { printf "child exited with value %d\n", $return >> 8; }