Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: return value from system call, exit status, shift right 8, bitwise and, $?

by shawnhcorey (Friar)
on Feb 11, 2010 at 14:15 UTC ( [id://822657]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://822657]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-04-24 17:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found