List::MoreUtils

List::MoreUtils is a Perl module that can provide the stuff missing in List::Util.
Download

List::MoreUtils Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Tassilo von Parseval
  • Publisher web site:
  • http://search.cpan.org/~vparseval/

List::MoreUtils Tags


List::MoreUtils Description

List::MoreUtils is a Perl module that can provide the stuff missing in List::Util. List::MoreUtils is a Perl module that can provide the stuff missing in List::Util.SYNOPSIS use List::MoreUtils qw(any all none notall true false firstidx first_index lastidx last_index insert_after insert_after_string apply after after_incl before before_incl indexes firstval first_value lastval last_value each_array each_arrayref pairwise natatime mesh zip uniq minmax);List::MoreUtils provides some trivial but commonly needed functionality on lists which is not going to go into List::Util.All of the below functions are implementable in only a couple of lines of Perl code. Using the functions from this module however should give slightly better performance as everything is implemented in C. The pure-Perl implementation of these functions only serves as a fallback in case the C portions of this module couldn't be compiled on this machine.any BLOCK LISTReturns a true value if any item in LIST meets the criterion given through BLOCK. Sets $_ for each item in LIST in turn: print "At least one value undefined" if any { !defined($_) } @list;Returns false otherwise, or undef if LIST is empty.all BLOCK LISTReturns a true value if all items in LIST meet the criterion given through BLOCK. Sets $_ for each item in LIST in turn: print "All items defined" if all { defined($_) } @list;Returns false otherwise, or undef if LIST is empty.none BLOCK LISTLogically the negation of any. Returns a true value if no item in LIST meets the criterion given through BLOCK. Sets $_ for each item in LIST in turn: print "No value defined" if none { defined($_) } @list;Returns false otherwise, or undef if LIST is empty.notall BLOCK LISTLogically the negation of all. Returns a true value if not all items in LIST meet the criterion given through BLOCK. Sets $_ for each item in LIST in turn: print "Not all values defined" if notall { defined($_) } @list;Returns false otherwise, or undef if LIST is empty.true BLOCK LISTCounts the number of elements in LIST for which the criterion in BLOCK is true. Sets $_ for each item in LIST in turn: printf "%i item(s) are defined", true { defined($_) } @list;false BLOCK LISTCounts the number of elements in LIST for which the criterion in BLOCK is false. Sets $_ for each item in LIST in turn: printf "%i item(s) are not defined", false { defined($_) } @list;firstidx BLOCK LIST first_index BLOCK LISTReturns the index of the first element in LIST for which the criterion in BLOCK is true. Sets $_ for each item in LIST in turn: my @list = (1, 4, 3, 2, 4, 6); printf "item with index %i in list is 4", firstidx { $_ == 4 } @list; __END__ item with index 1 in list is 4Returns -1 if no such item could be found.first_index is an alias for firstidx. Requirements: · Perl


List::MoreUtils Related Software