use strict; use warnings; my $foo = "bar"; my %$foo=("key1"=>"value1","key2"=>"value2"); print $bar{"key1"};