Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2014-12-27 08:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls