![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
This blog post discusses the best answers to this question. As a short summary, if you can install CPAN modules then the best solutions are: or However, a more usual idiom is: which i find less clear.
But please don't use the first() function! It doesn't express the intent of your code at all. Don't use the "Smart match" operator: it is broken. And don't use grep() nor the solution with a hash: they iterate through the whole list. While any() will stop as soon as it finds your value. PS: i'm answering for people who will have the same question in the future. In reply to Re: How to find out if X is an element in an array?
by mascip
|
|