Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: echo $? in perl

by roboticus (Canon)
on Nov 30, 2007 at 20:59 UTC ( #654214=note: print w/ replies, xml ) Need Help??

in reply to echo $? in perl


As you were told repeatedly in the CB yesterday, your problem is that you insist on persist in using:

eval { $mov=$ssh->exec("echo $?\n","2"); }; warn $@ if $@;
instead of:
eval { $mov=$ssh->exec('echo $?\n',"2"); }; warn $@ if $@;
In the first, perl is evaluating the $? for you, so the remote machine sees something utterly different. It's seeing 'echo 0\n' instead of 'echo $?\n'. So of course you're always going to get a zero result...


Update: Upon rereading, the tone was harsher than intended.

Comment on Re: echo $? in perl
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2015-01-26 10:05 GMT
Find Nodes?
    Voting Booth?

    My top resolution in 2015 is:

    Results (189 votes), past polls