in reply to "system" returns different exit code than running the command from the command line

quoting perldoc system:
The return value is the exit status of the program as returned by the "wait" call. To get the actual exit value, shift right by eight

And farther down:

printf "child exited with value %d\n", $? >> 8;

Is there any way the documentation could be clearer about it?

  • Comment on Re: "system" returns different exit code than running the command from the command line
  • Download Code

Replies are listed 'Best First'.
Re^2: "system" returns different exit code than running the command from the command line
by greenmoss (Novice) on Jun 04, 2008 at 18:36 UTC
    Oh, I get it... I thought the "$code & 127" did the bit shifting. Blinders on I guess. Thanks.