[oak perl] Comparing two files

M. Lewis cajun at cajuninc.com
Sun May 29 16:17:27 PDT 2005


Thanks Jim. I'll check out the module.

Thanks,
Mike


James Keenan wrote:
>>From: "M. Lewis" <cajun at cajuninc.com>
>>
>>I'm writing a script to compare two text files ($shortfile & 
>>$longfile).
>>If a line appears in $shortfile, but that line is not in $longfile, 
>>then
>>I want to write that line out to $differences
>>
>>I'm relatively certain it is not efficient to open $longfile for each
>>entry in $shortfile. Both files are of the magnitude of 800+ lines.
> 
> 
> As Michael Paoli and Mark Bole have noted these files are small enough 
> that you can slurp them into memory and deal with them as arrays or 
> hashes.
> 
> My List-Compare module, available on CPAN, has methods such as 
> get_unique() and get_difference() which might be useful in this 
> respect.  It can handle either arrays or hashes as arguments.
> 
> Jim Keenan
> 
> _______________________________________________
> Oakland mailing list
> Oakland at pm.org
> http://mail.pm.org/mailman/listinfo/oakland
> 

-- 

  Unprecedented performance: Nothing ever ran this slow before.
  18:16:01 up 4 days, 33 min,  5 users,  load average: 0.06, 0.06, 0.02

  Linux Registered User #241685  http://counter.li.org


More information about the Oakland mailing list