Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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 wandering the Monastery: (12)
As of 2014-09-30 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (378 votes), past polls