- any BLOCK LIST
-
Evaluates the BLOCK for each element of the LIST (locally setting
$_
to each element) and checks the truth of the result of that block. Returns true if at least one element makes the block yield true, or returns false if no element is found to make it true.Evaluates the BLOCK for each element of the LIST (locally setting
$_
to each element) and checks the truth of the result of that block. Returns true if at least one element makes the block yield true, or returns false if no element is found to make it true. (TBT)As soon as any element makes the block yield true, then the result of this operator is determined. It will short-circuit in that case and not consider any further elements.
As soon as any element makes the block yield true, then the result of this operator is determined. It will short-circuit in that case and not consider any further elements. (TBT)
When used as a condition, this is similar to grep, except for this short-circuit behaviour.
When used as a condition, this is similar to grep, except for this short-circuit behaviour. (TBT)
if( any { length $_ } @strings ) { say "At least one string is non-empty"; }
is roughly equivalent to
is roughly equivalent to (TBT)
if( grep { length $_ } @strings ) ...
This operator is only available if the
keyword_any
feature is enabled.This operator is only available if the
keyword_any
feature is enabled. (TBT)It is currently considered experimental, and will issue a compile-time warning in the category
experimental::any
unless that category is silenced.It is currently considered experimental, and will issue a compile-time warning in the category
experimental::any
unless that category is silenced. (TBT)