DEV Community

Matthew O. Persico
Matthew O. Persico

Posted on

Perl Lists - a Partial Taxonomy

Mark Garder recently published the article A list of Perl list processing modules, a detailed and factual, unopinionated listing of eight Perl modules that manipulate lists. So, naturally, when his factual, unopinionated listing was cross posted to Redit, the first comment was the emotional, highly opinionated: “So how do we go about fixing this mess? Because it is a mess.”.

Yes, the comment was mine.

My intent was to see if we could create One List:: To Rule Them All. Not only does it confuse people who want to learn Perl to have various list functions in different modules (and to have functions that share a name across modules work differently), but it also confuses Perl veterans.

And yes, once again, that’s me.

After some consideration, some education and a conversation with the current maintainer of List::Util, the module of list functions that come with Perl itself, it seemed to me that the first order of operations was to detail just how much of a “mess” this was. So, on Sunday afternoon, while waiting to go to the airport to pick up my son, and while watching Phil Mickelson winning the PGA championship at a record 50 years old, I put together the following spreadsheet:

I hope that this can serve a as reference for people to see what's available and where it is available. Yes, it may not have a long shelf life, but I learned a bit more about the state of the List:: namespace. Hopefully, you'll learn a bit too.

Top comments (3)

mjgardner profile image
Mark Gardner

Happy to start the discussion and looking forward to what results

sigzero profile image

So it there a "One List:: To Rule Them All" possible?

matthewpersico profile image
Matthew O. Persico

I don't think so. No. There are enough differences between L::U and L::MU for the same function names that a complete merge probably isn't possible. L::U uses array refs as arguments to functions that process multiple lists. L::MU uses arrays with prototyping. The best we could do is copy as much as possible to L::U and update L::MU to either point users to L::U or maybe load it up and just pass though.