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.