Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 browsing the Monastery: (4)
As of 2015-07-02 03:40 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 (27 votes), past polls