Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 ( #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? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2022-09-28 09:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (124 votes). Check out past polls.

    Notices?