any#
True if the block returns true for at least one element.
Synopsis#
my $bool = any { BLOCK } @list;
if ( any { length > 10 } @strings ) { ... }
For each element any sets $_ to that element and calls the
block in scalar context. It returns true as soon as the block
returns true for any element, without examining the rest. For an
empty list it returns false.
What you get back#
1 if any element satisfied the block, 0 otherwise.
Examples#
warn "has empty" if any { $_ eq '' } @values;
die "has admin" if any { $_->is_admin } @users;
my $ok = any { /^--help$/ } @ARGV;
Differences from upstream#
Fully compatible with upstream.
See also#
all— require every element to match.none— require no element to match.first— return the matching element itself.