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. If you use a list of arguments, then you get the return status of the program but none of the argument are interpoled. This may be a good thing or a bad thing, depending on what you expect.
Example: a single string argument:
my $status = system( "foobar arg1 arg2 arg3" );
$status contains the status of the shell or CMD.EXE.
Example: a list of arguments:
my $status = system( "foobar", "arg1", "arg2", "arg3" );
$status contains the status of foobar.
In reply to Re: return value from system call, exit status, shift right 8, bitwise and, $?
by shawnhcorey
in thread return value from system call, exit status, shift right 8, bitwise and, $?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |