in reply to return value from system call, exit status, shift right 8, bitwise and, $?

system() is one of those weird commands that do different things depending on their arguments. It you use a single string argument, the return status is the status of the shell (or CMD.EXE on Windows). Most often, this is zero (success) even if the shell could not find a program to run.

I'm not seeing that:

use strict; use warnings; use 5.010; my $status = system( "foobar arg1 arg2 arg3" ); say $status; --output:-- Can't exec "foobar": No such file or directory at 2perl.pl line 5. -1
os x 10.4.11
  • Comment on Re: return value from system call, exit status, shift right 8, bitwise and, $?
  • Download Code

Replies are listed 'Best First'.
Re^2: return value from system call, exit status, shift right 8, bitwise and, $?
by shawnhcorey (Friar) on Feb 11, 2010 at 16:09 UTC

    YMMV. And here I thought I had it figured out. :(

    I wonder what happens on Windows.