- 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.LIST の各要素に対して BLOCK を評価し(各要素はローカルに
$_に設定されます)、ブロックの真偽をチェックします。 少なくとも一つの要素がブロックの結果を真にした場合に真になり、 どの要素もがブロックの結果を真にしなかった場合に偽になります。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.
どれかの要素がブロックの結果を真にした時点で、この演算子の結果は 決定されます。 この場合短絡評価され、残りの要素は考慮されません。
When used as a condition, this is similar to grep, except for this short-circuit behaviour.
条件として使うと、これは次の短絡評価の振る舞いを除いて grep と似ています。
if( any { length $_ } @strings ) { say "At least one string is non-empty"; }is roughly equivalent to
これはおおまかに次と等価です:
if( grep { length $_ } @strings ) ...This operator is only available if the
keyword_anyfeature is enabled.この演算子は、
keyword_any機能 が 有効の場合にのみ利用可能です。It is currently considered experimental, and will issue a compile-time warning in the category
experimental::anyunless that category is silenced.これは現在のところ 実験的 と考えられており、
experimental::anyカテゴリの 警告を抑制しない限り、このカテゴリのコンパイル時警告が発生します。