Item Description: Easily creates sophisticated comparison information about arrays.
I had to create a report of the differences between two files each containing thousands of unsorted records. I *thought* that I needed some form of Diff. I tried Algorithm::Diff, but discovered that it only works line-by-line. For instance, Algorithm::Diff reports that (1,2,3) and (2,1,3) are different lists.
Furthermore, some commercial tools I tried did the same thing.
I accidentally stumbled across List::Compare, which was lucky for two reasons.
Most importantly, List::Compare solved my problem, and more: it shows intersections and unions of sets; it shows elements unique to either list (that was my particular problem); it shows all unique elements of both lists, and even all elements of both lists. The interface is elegant and intuitive. I'll be dealing with large inventory lists well into the future, and List::Compare is shaping up to be my tool of first resort for all my list comparison needs.
I was also lucky because James Keenan gives a detailed history of the source (Perl Cookbook) and the circumstances (introductory Perl course) that inspired him to write the module, as well as pointing out a number of similar modules, just in case List::Compare doesn't solve your particular problem. I am relatively new to Perl, and I don't entirely grok the power of hashes yet. List::Compare not only allowed me to solve my immediate problem quickly and elegantly, but it also showed me how to understand the code that underlies the List::Compare module itself.
Elegant, intuitive, well-documented, and with great hints about the magic behind the module. I'm glad I found List::Compare, and you probably will be, too.
|Replies are listed 'Best First'.|
by dragonchild (Archbishop) on Mar 25, 2004 at 17:49 UTC
by davorg (Chancellor) on Mar 25, 2004 at 19:49 UTC