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

Re^3: Hash element exists/delete (= in conditional)

by LanX (Canon)
on Jan 22, 2013 at 10:54 UTC ( #1014621=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Hash element exists/delete
in thread Hash element exists/delete

Because it's valid code, $two could be a boolean to be tested and as a side-effect $one is set.

try

perl -e 'use strict; use warnings; my $one = 1; if( $one = 2 ) { prin +t "True\n"; } else { print "False\n"; } ' Found = in conditional, should be == at -e line 1. True

or

perl -we '$a=1; print (($a = 2) ? "True" : "False");' Found = in conditional, should be == at -e line 1.

cause now it makes less sense.

YMMV!

Cheers Rolf

UPDATE

And personally I would be glad if this would cause a warning, too!


Comment on Re^3: Hash element exists/delete (= in conditional)
Select or Download Code
Re^4: Hash element exists/delete (= in conditional)
by tmharish (Friar) on Jan 22, 2013 at 11:19 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2015-07-07 09:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls