use strict; my($f1,$f2,%ids_in_f1,%ids_in_f2); my($file,$count); $f1 = "f1_name.txt"; $f2 = "f2_name.txt"; open(F1,$f1); while() { my(@col); chop; next if(/\+/); next if(!$_); @col = split(/\s,\s/); $ids_in_f1{$col[0]} = 1; } close(F1); open(F2,$f2); while() { my(@col); chop; next if(/\+/); next if(!$_); # Split this file on tabs @col = split(/\t/); # This time the id is in the second column $ids_in_f2{$col[1]} = 1; if(!$ids_in_f1{$col[1]}) { print " Missing ID ".$col[1]."\n"; } } close(F2); $count = 0; print "\nThings in F1 not in F2\n"; foreach $file (sort keys(%ids_in_f1)) { next if($ids_in_f2{$file}); print " $file\n"; $count++; } print "Total things in F1 not in F2 $count\n\n";