package Bob; my $thingy = {One => 1, Two => 2}; sub doit { my $key = '{One}'; eval "print \"thingy one is \$thingy->$key\n\""; #my $x = $thingy; } 1;