in reply to Re: Setting the value of a complicated hash ref
in thread Setting the value of a complicated hash ref

I think the reason my fix works is this;
You are building a HOH by adding to it at each start_tag here -
$pos[$depth] = \${$pos[$depth - 1]}->{$element->{Name}};
If later, you allow a text string to be assigned to $pos[$depth] then at the next depth the program fails because \${$pos[$depth - 1]} is now not a hash reference.
The text string should only be assigned when you reach the lowest level. In your XML data this conveniently is when there are no line breaks in the data. This is a big assumption and I would not do this for a serious application - much better to use the proper tools.
Hope this helps, I too am learning from this
poj