$ perl -le '$h = {foo => "bar"}; $k = "foo"; print "$h->{$k}";' bar