# process file1 line by line while ($line = ) { # split up the current line in file1 @fields = split /!/, $line; # for each line in the 2nd file foreach $lineref (@file2) { $number_of_matches = 0; # compare the two lines for $index (0..$number_of_fields) { $number_of_matches++ if ($lineref->[$index] eq $fields[$index]); } print "Matchinfo: ..."; } }