in reply to return a value from perl script to perl module call ing the script
If you look at the system documentation, you'll see that the exit status is returned in a kind of "encoded" format. That is to say, the value of the exited process is returned in the variable $?, but shifted left 8 bits.
What you need to do to get the exit status of the child is:
my $exit_value = ($? >> 8);
The lower 7 bits hold the number representing the signal (if any) that the child died with, and the 8th bit is set iff the child process dumped core. ("iff" = if and only if).
|
|---|