foreach (readline FILE1) { if (/$hashnew{$com}/){ print WFILE "$_\n"; } }