The Perl Advent Calendar needs more articles for 2022. Submit your idea today!

NAME

List::Utils - Additional list utilities

SYNOPSIS

 use List::Utils qw(:all);

 print 'all "true", so to speak'  if all(@data);
 print 'none true' if none(@data);
 print 'at least 1 false' if notall(@data);
 if (notall(@data)) {
    printf "as a matter of fact, %d are true and %d are false", 
    true(@data), false(@data);
 }

DESCRIPTION

You know the things that Graham said could be implemented in Perl in the List::Util (part of Scalar::List::Util release) docs but didn't? Well, here they are.

  • all returns true if all arguments are true

  • none returns true if all arguments are false

  • notall returns true if any argument is false

  • true returns how many elements are true

  • false returns how many elements are false

EXPORT

None by default. use List::Utils qw(:all) to import all subs.

AUTHOR

T. M. Brannon, <tbone@cpan.org>

SEE ALSO

perl(1).