in reply to need help with xml parser
It's impossible to debug your problem from the info given. You should double check the contents of $name. It is fine to do what you say you are doing, as this will show:
$ perl -le '$h = {foo => "bar"}; $k = "foo"; print "$h->{$k}";' bar
|
|---|