Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: given-when construct unexpected bahavior wit arrays

by Neighbour (Friar)
on Jun 07, 2012 at 13:32 UTC ( #974957=note: print w/ replies, xml ) Need Help??


in reply to given-when construct unexpected behavior with arrays

With grep, you're using a regular expression to find matches, which means all numeric values are stringified and then compared (as string).
You're almost there when you conclude that if you remove 0, elements 'a', 'ab' and 'abc' are not found anymore...
Apparently given-when does 'a' == 0 (which is true, when converting the string 'a' to a numerical value, it yields 0).

Edit: Aw, beaten to it by toolic :)


Comment on Re: given-when construct unexpected bahavior wit arrays

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2014-09-18 20:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (124 votes), past polls