all#
True if the block returns true for every element (including empty list).
Σύνοψη#
my $bool = all { BLOCK } @list;
if ( all { defined } @values ) { ... }
For each element all sets $_ to that element and calls the block in scalar context. It returns false as soon as the block returns false for any element. An empty list yields true (the conventional «vacuous truth»).
Τι επιστρέφεται#
1 if every element satisfied the block, 0 otherwise.
Παραδείγματα#
die "found empty string" unless all { length } @strings;
my $ready = all { $_->is_ready } @workers;
my $yes = all { $_ > 0 } (); # 1 - vacuous truth
Διαφορές από το upstream#
Fully compatible with upstream.
Δείτε επίσης#
any- require at least one match.notall- inverse: at least one failure.none- inverse: zero matches.