open FIRST, "first.csv"; while (my $line = ) { open SECOND, "second.csv"; while (my $otherline = ) { if ( $line eq $otherline ) { print "Found a match!\n": } } close SECOND; } close FIRST;