DB<12> use List::Util qw/reduce/ DB<13> sub any(&@) { my $code_ref = shift; reduce { $a or $code_ref->(local $_ = $b) } @_; } DB<15> print "true\n" if any { $_ < 0 } qw /3 12 4 5 7/; true
Cheers Rolf
( addicted to the Perl Programming Language)
In reply to Re^6: Smartmatch alternatives
by LanX
in thread Smartmatch alternatives
by cavac
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |