in reply to If Statements and Regular Expressions

What you are missing is use strict;.

I stronlgy suggest you read: Coping with scoping.

As far as your problem goes: I'm guessing you want: if ($key =~ /Hox/) { instead of if ($Gene_Symbol =~ /Hox/) {.