Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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.


Comment on Re: Wrong behavior of the implicit smart operator in the given/when blocks
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2014-08-22 09:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (152 votes), past polls