Package Report; sub new() { my $self = {}; bless($self); [...] $self->{tree} = (); my $p = new XML::Parser( Handlers => { Start => \&handle_start, Default => \&handle_char, } ); $p->parsefile($my_file); sub handle_char() { # ... update $self->{tree} } sub handle_start() { # ... update $self->{tree} print Dumper \$self->{tree}; #dumper 1 } print Dumper \$self->{tree}; #dumper 2 return $self; }