Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Question on qx

by narashima (Beadle)
on Nov 03, 2006 at 20:49 UTC ( #582160=perlquestion: print w/replies, xml ) Need Help??
narashima has asked for the wisdom of the Perl Monks concerning the following question:

Revered Monks,
What is return value of qx ? I tried doing the following but I did not get any value for $status.
$status = qx/cat new1 >new/; print "value of status is $status \n";
The output of the code above is:

"Value of status is "

Could anyone enlighten me please.


Replies are listed 'Best First'.
Re: Question on qx
by BUU (Prior) on Nov 03, 2006 at 20:53 UTC
    The output of qx// is whatever the program inside's STDOUT is. In your specific case you send all of the program's STDOUT to a file, so there is none left for perl to read.
      if BUU's explanation wasn't enough, perhaps perlop can help
        If you're looking for the return code of the command you're running, you can use system().

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://582160]
Approved by Paladin
[Corion]: My current approach for subtotals involves rerunning the given query, with the hint to the user that they should use a temporary table if they want better performance.
[Corion]: But I could create that temporary table in the module and use it for the improved perfomance directly instead.
[Corion]: And the question is, what would be better/preferred ;-)
[Corion]: Hmm - not exactly like the ROLLUP command. Ah well.
[hippo]: Make it an option?

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2017-02-23 15:28 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (347 votes). Check out past polls.