my $twig = XML::Twig->new(twig_handlers => {a'=> \&Test ); # Parse the file $twig->parsefile($XmlFile); # Handler sub routine sub Test { my ($parser, $element) = @_; # This prints element along with its contents to some out +put file $element->print(\*OP); # However What I really want done over here is have element a long with its subelements and text be copied to another variable instead of being printed on screen }