Hashes are your friends!

my $file1 = "file1";
my $file2 = "file2";
my %file1_names;

open(IN1,$file1) or die $!;
while (<IN1>) {
  chomp;
  $file1{$_} = 1;
}
close IN1;

open(IN2,$file2) or die $!;
while (<IN2>) {
  chomp;
  print "Found matching name: '$_'\n" if $file1{$_};
}
close IN2;

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Paul
Sent: Friday, November 11, 2005 1:49 PM
To: [email protected]
Subject: Comparing 2 text files

Hi,

What is the best way to compare 2 text files for
matching. Let's say both files have just people names
Thanks

File1           File2
James           Joe
Tina            Patrick
Steve           James
...             ....



        
                
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to