Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Wrong behavior of the implicit smart operator in the given/when blocks

by ikegami (Pope)
on Apr 30, 2012 at 15:42 UTC ( #968103=note: print w/replies, xml ) Need Help??


in reply to Wrong behavior of the implicit smart operator in the given/when blocks

The docs say:
when($foo)

is exactly equivalent to

when($_ ~~ $foo)

Not when ($foo ~~ $_). The value passed to given is the thing being checked. In your example, the first case matches because your string matches your hash, but the next two fail because your hash doesn't match your string.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://968103]
help
Chatterbox?
[LanX]: Bishop LanX starts singing: ♪..♫ I want it all ...♩..♬
LanX ♪..♫ ...and I want it now!!! ♩..♬
[LanX]: damn my headphones were not plugged and the video blasted thru the office ...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2017-09-20 15:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (237 votes). Check out past polls.

    Notices?