none#

True if the block returns true for no element (including empty list).

Σύνοψη#

my $bool = none { BLOCK } @list;
if ( none { $_ < 0 } @measurements ) { ... }

For each element none sets $_ to that element and calls the block in scalar context. It returns false as soon as the block returns true for any element. An empty list yields true.

Τι επιστρέφεται#

1 if every element failed the block, 0 otherwise.

Παραδείγματα#

die "negatives present" unless none { $_ < 0 } @measurements;
my $clean = none { /ERROR/ } @log_lines;
my $none  = none { 1 } ();               # 1 - nothing to fail

Διαφορές από το upstream#

Fully compatible with upstream.

Δείτε επίσης#

  • any - inverse: at least one match.

  • all - require every element to match.

  • notall - at least one failure.