[go: up one dir, main page]

DEV Community

Cover image for A list of Perl list processing modules
Mark Gardner
Mark Gardner

Posted on • Originally published at phoenixtrap.com on

A list of Perl list processing modules

As previously written, I like list processing. Many computing problems can be broken down into transforming and filtering lists, and Perl has got the fundamentals covered with functions like map, grep, and sort. There is so much more you might want to do, though, and CPAN has a plethora of list and array processing modules.

However, due to the vicissitudes of Perl module maintenance, we have a situation where it’s not clear at a glance where to turn when you’ve got a list that needs processing. So here’s another list: the list modules of CPAN. Click through to discover what functions they provide.

  • We’ve got List::Util which has been released as part of Perl since version 5.7.3.
  • We’ve got List::MoreUtils which has some functions which are named the same as Util but behave differently.
  • We’ve got List::SomeUtils which duplicates MoreUtils but with fewer dependencies.
  • We’ve got List::UtilsBy which MoreUtils has also cribbed some functions from.
  • We’ve got List::AllUtils which attempts to consolidate Util, SomeUtils, and ListBy but has some exceptions to called modules because of the aforementioned duplication between Util and SomeUtils.
  • We’ve got List::Util::MaybeXS which helps with pure Perl fallbacks in case your version of Util is too old to have a certain function.
  • We’ve got List::MoreUtils::XS which provides (some?) faster versions of MoreUtils’ functions (but you still have to use MoreUtils).
  • And lastly, we have Util::Any which lets you import functions from Util, MoreUtils, and just for good measure Scalar::Util, Hash::Util, String::Util, String::CamelCase, List::Pairwise, and Data::Dumper. But it hasn’t been updated since 2016, so it doesn’t necessarily export the functions added to those modules since then.

Am I missing anything? Probably! But these are the ones most associated with being upstream on the CPAN River, so they (or the modules they consolidate) have more projects depending on them.

Top comments (0)