Dear Perlers

Please throw some light on the $? variable

I am trying to figure out how the internal structure (format) of $? variable. 
Please throw some light on this topic.

Any help is highly appreciated.

[code]
system('cat file1.txt');

if($?) {#A Non zero exit code means failure
if($? == -1) {# -1 means the program didn't even start
print "Failed to run program: $!\n";
} else {
print "Actual value of (\$?) is $?\n";
print "The exit value was : ", ($? >> 8), "\n";
print "The signal number that terminated the
       program was:", ($? & 127), "\n";
print "The program dumped core\n" if $? & 128;
}
}
[/code]

In the above code

1) Why we are right shifting the $? variable by 8 (I know we are to get the 
exit value but what is the internal format or representation of $?)
2) What is the signal number here?
3) What is the core dump?
 
best,
Shaji 
-------------------------------------------------------------------------------
Your talent is God's gift to you. What you do with it is your gift back to God.
-------------------------------------------------------------------------------

Reply via email to