in reply to hash confusion

I believe that you're looking for this:

if ( $hash{$1} == $2 )