in reply to Re: "Useless use of a constant" in grep block?
in thread "Useless use of a constant" in grep block?

I'm aware of List::Util's any/none/first. Depending on the size of the list, grep or do { for ... } can be faster than List::Util's offerings because there is no subroutine call and argument passing overhead. Also there's a shortcutting variant of grep using eval { grep { ... and die } ... } idiom. I made a benchmark on this in Bencher::Scenario::PERLANCAR::grep_bool.

  • Comment on Re^2: "Useless use of a constant" in grep block?