in reply to Re^3: Trouble grepping values when hash contains multiple values per key
in thread Trouble grepping values when hash contains multiple values per key
Because grep always iterates through the entire list, to stop on the first one found, you might try instead:my $found_any = grep { ... } @whatever;
or:use List::MoreUtils qw(any); my $found_any = any { ... } @whatever;
...though, in practice, it is unlikely to matter, performance-wise, unless @whatever is huge.use List::Util qw(first); my $found_any = defined first { ... } @whatever;
As an aside, note that both any and first are built in to Perl 6.
|
|---|