[oak perl] Comparing two files

M. Lewis cajun at cajuninc.com
Sat May 28 20:49:11 PDT 2005


my $shortfile;
my $longfile;
my $differences;


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.

For example, a given line in $shortfile is found at line 333 in 
$longfile. Without closing and reopening $longfile, I don't know how to 
reset the 'pointer' in $longfile back to line 1.

Perhaps there is a better way of doing this. I hope I've explained what 
I'm trying to do clearly.

Suggestions ?

Thanks,
Mike

-- 

  Revolutionary: The disk drives go round and round.
  22:41:01 up 3 days,  4:58,  6 users,  load average: 0.00, 0.00, 0.00

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


More information about the Oakland mailing list