in reply to Re^5: Smartmatch alternatives
in thread Smartmatch alternatives
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)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Smartmatch alternatives
by Laurent_R (Canon) on Dec 18, 2013 at 00:08 UTC | |
|
Re^7: Smartmatch alternatives
by Laurent_R (Canon) on Dec 18, 2013 at 15:55 UTC |