The stupid question is the question not asked | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
If grep were to be made shortcutting in boolean/scalar context (returning only the first result, or returning just true/false), would it break many programs? I would prefer a shortcutting grep, making it behave like List::Util's first but faster for larger lists. Also, what do you guys think of this idiom to simulate shortcutting of grep: if (eval { grep {$_==$wanted and die} @ary}, @$) { say "match" } Also, how about shortcutting map() too in boolean context? Although that makes less sense. In reply to Shortcutting grep in boolean context by perlancar
|
|