in reply to Re: Re: Variable scope with XML::Parser
in thread Variable scope with XML::Parser

Ah that! For sure you can resolve this for many ways. Here is one (it might be a bit convoluted, I admit):
my $p = new XML::Parser (Handlers => {Start => sub{hdl_start($tag, $na +me, @_)}, ...
and
sub hdl_start { $_[0] = $_[2]; $_[1] = $_[3]; }
What I use here is an anonymous subroutine as the handler, and I've changed the hdl_start subroutine to change it's two first parameters ($_[0] and $_[1]).