Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Can you guess the result? Is it a bug?

by The Mad Hatter (Priest)
on Jul 31, 2003 at 03:47 UTC ( [id://279472]=note: print w/replies, xml ) Need Help??


in reply to Re: Can you guess the result? Is it a bug?
in thread Can you guess the result? Is it a bug?

Because $test is in double-quotes, your shell is trying to interpolate it. Since it isn't set though (and there aren't such things as warnings and strict for the shell ; ), it is replaced with nothing and becomes:
perl -wMstrict -e"if( my() = 0 ) { print 'Passed'; } else { print 'Fai +led'; }"
If you escape the $ you'll be fine.
perl -wMstrict -e"if( my(\$test) = 0 ) { print 'Passed'; } else { prin +t 'Failed'; }"

Replies are listed 'Best First'.
Re: Re: Re: Can you guess the result? Is it a bug?
by Cine (Friar) on Jul 31, 2003 at 13:31 UTC
    A better way is to make sure the shell doesnt even try...
    perl -wMstrict -e'if( my() = 0 ) { print "Passed"; } else { print "Failed"; }'

    T I M T O W T D I

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-03-29 05:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found