- or download this
# One argument is true
sub any { $_ && return 1 for @_; 0 }
- or download this
sub any(&@) {
my $code = shift;
$code->() && return 1 for @_;
0
}
- or download this
my $has_undefs = first { not defined } @list;
- or download this
sub count(&@) {
my $code = shift;
scalar grep { $code->() } @_
}