http://qs321.pair.com?node_id=169934


in reply to Problem with a Ref to a global variable while using XML::Parser

I think you answered your own question (Effectively deal with the global hash variable (by redefining it?)). Can't you just let the last thing on @stories be the hash reference and not even deal with the hash?
sub StartTag { # Other stuff okay... but add.. if ($tag eq 'story') { push @stories, {}; } } # This subroutine is mostly superflous now I think... sub EndTag { pop @curr; } sub Text { unless ($curr[-1] eq 'story') { $stories[-1]->{$curr[-1]} = $_; } }
And that might do it. (untested)