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; #### #!/usr/local/bin/perl use strict; use warnings; use Bob; Bob->doit(); #### Use of uninitialized value in concatenation (.) or string at (eval 1) line 1. thingy one is #### thingy one is 1