in reply to return a value from perl script to perl module call ing the script

Hi bsachin,

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).


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/