Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^5: How to check if a variable's value is equal to a member of a list of values

by dbuckhal (Monk)
on Mar 26, 2013 at 22:55 UTC ( #1025598=note: print w/ replies, xml ) Need Help??


in reply to Re^4: How to check if a variable's value is equal to a member of a list of values
in thread How to check if a variable's value is equal to a member of a list of values

Yes, I would agree that more logic increases runtime, but from your example, are you saying that grep should be faster? Please explain your example, so I understand you clearly.

Personally, I have no idea how grep, map, or ~~ all work "under the hood". In your syntax, I see grep and map both iterating over the list, so my guess was they would have performed equally. I was surprised at my results.


Comment on Re^5: How to check if a variable's value is equal to a member of a list of values
Select or Download Code
Replies are listed 'Best First'.
Re^6: How to check if a variable's value is equal to a member of a list of values
by LanX (Canon) on Mar 26, 2013 at 23:00 UTC
    > are you saying that grep should be faster?

    no I'm showing that grep {TEST} is more complex than map {TEST}

    Cheers Rolf

    ( addicted to the Perl Programming Language)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2015-07-31 00:04 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 (274 votes), past polls