in reply to list lines not found in config (while+if)

Yes. Use a hash. If file1 has more than 10000 or 100000 lines then you need a disk-based hash or database, but normally you just use something like this:

use strict; use warnings; my %seeninfile1; open FH,"<",$file1 or die "Can't open $file1: $!\n"; while (<FH>) { $seeninfile1{$_}++; } close(FH); open FG,"<",$file2 or die "Can't open $file2: $!\n"; while (<FG>) { ($key,$number)= split; if ($seeninfile1{$key} { #do whatever you want to do if key is not in file1 } else { #do whatever you want to do if key is in file1 } } close(FH);

Using a hash means you will read both file1 and file2 only once. Your code reads in file1 once for every line(!) of file2. Your code will quickly slow down when your files get bigger.