$file = 'test_predictions_1'; open (FH, ") { chop; # remove trailing newline $id = $_; if (exists $data{$file}{$id}) {print "match\n";} }