April 04, 2004

Compare two lists with Perl

A requirement at our Siebel shop: take a partners list of 30k+ policies, and compare it with an internal list, and find the differences.

The Siebel admin got as far as getting the partner list and the internal list into two files, with one policy number per line. I volunteered perl as the perfect tool for finding the differences.

I got a version churned out in less than an hour, which works well and fast (1 or two seconds) on two 30000 entry file. Unfortunately I didn't find the perl module List::Compare before I started coding. If I used List::Compare that 1 hour or so probably would be 10 minutes. Oh well - it was kind of fun to make, and think about how to make it fast. At least my script doesn't require the admins to install any perl modules, such as List::Compare, which they can't do easily because of the firewall, and they don't know Perl well enough to do so. And it creates an output files.

So I'm not going to change my script to use List::Compare, so if you want a one pager that can compare two lists really fast go ahead and down load it.

Here is a text version: filecompare.txt

Posted by choppen5 at 05:08 PM