in reply to Creating hash with variables

$ipkey{'$key'} = '$value';

Aside from the interpolation issue already mentioned by previous answers, this is a useless use of quotes. You want to use the values of the variables, not their names, and you aren't trying to insert them into a larger string, so don't quote them at all:

$ipkey{$key} = $value;