perlquestion
perlancar
<p>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.
<p>Also, what do you guys think of this idiom to simulate shortcutting of grep:
<p><code>if (eval { grep {$_==$wanted and die} @ary}, @$) { say "match" }</code>
<p>Also, how about shortcutting map() too in boolean context? Although that makes less sense.