The additional bonus of List::Util::first() is that it is compiled, so you will get performance akin to grep.
I wrote a myfirst using for that shortcircuits like List::Util:
Rate myfirst first
myfirst 875/s -- -83%
first 5236/s 498% --
More interesting, possibly, is a comparison of grep and first solutions - does the slight overhead of calling first (a compiled, but still user, function) out-weight the benefit?
|