- or download this
if ($? == -1) {
print "failed to execute: $!\n";
...
printf "child exited with value %d\n", $? >> 8;
}
- or download this
Bit# 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
| | | | | | | | | | | | | | | |
...
+-- exit code (8bit) | +-- signal code (7bit)
|
+-- core-dumped flag
- or download this
my $exit_status = int( $? / 256 ); # quick and dirty exit-state
# decimal arithmetic so to speak
# (works for positive numbers)