Revision b2b1edc8
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/MoreCommon.pm | ||
---|---|---|
3 | 3 |
require Exporter; |
4 | 4 |
our @ISA = qw(Exporter); |
5 | 5 |
|
6 |
our @EXPORT = qw(save_form restore_form compare_numbers any cross);
|
|
6 |
our @EXPORT = qw(save_form restore_form compare_numbers cross); |
|
7 | 7 |
our @EXPORT_OK = qw(ary_union ary_intersect ary_diff listify ary_to_hash uri_encode uri_decode); |
8 | 8 |
|
9 | 9 |
use List::MoreUtils qw(zip); |
... | ... | |
76 | 76 |
return $a <=> $b; |
77 | 77 |
} |
78 | 78 |
|
79 |
sub any (&@) { |
|
80 |
my $f = shift; |
|
81 |
return if ! @_; |
|
82 |
for (@_) { |
|
83 |
return 1 if $f->(); |
|
84 |
} |
|
85 |
return 0; |
|
86 |
} |
|
87 |
|
|
88 | 79 |
sub cross(&\@\@) { |
89 | 80 |
my $op = shift; |
90 | 81 |
use vars qw/@A @B/; |
Auch abrufbar als: Unified diff
Eigene Implementation von 'any' durch List::MoreUtils ersetzt