Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: How to get the exit status and the output of the command launched in perl

by sunshine_august (Scribe)
on May 26, 2009 at 10:31 UTC ( #766183=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    [larry@august-dev perl]$ curl --max-time 3 http://someweb.org 2>&1
    curl: (6) name lookup timed out
    [larry@august-dev perl]$ echo $?
    6
    
  2. or download this
     #!/usr/bin/perl
     use strict;
    ...
     my $result = `curl --max-time 3 http://someweb.org 2>&1`;
     print "exit status: $?\n";
     print "result:\n", $result, "\n";
    
  3. or download this
    [larry@august-dev perl]$ ./foo.pl
    exit status: 1536
    result:
    curl: (6) name lookup timed out
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (20)
As of 2015-07-01 15:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (3 votes), past polls