Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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

by bot403 (Beadle)
on Feb 11, 2010 at 15:24 UTC ( [id://822670]=note: print w/replies, xml ) Need Help??


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

Others have covered your original question pretty well so I'll just chip in that I'm a fan of this construct in my code to get both the output and the RC.

This doesn't quite cover all the bases but can be expanded to do so.

eval { open P,"$cmd 2>&1 |"; }; if($@) { die('Cant launch cmd') } my @output=<P>; close P; my $rc = $? >> 8;
  • Comment on Re: return value from system call, exit status, shift right 8, bitwise and, $?
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-18 15:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found