How can I return the entire xml tag using xml::twig and save it to array:
for example :
my @array=();
my $twig = XML::Twig->new(
twig_handlers => {
'data'=> sub {push @array, $_->xml_string;}
});
This code return all the nested tags but without the tag itself and its properties is there an option to return the entire tag using xml::twig and save it to varaible ?
Use XML::Twigs method
sprintinstead ofxml_string. The docs say that:A search for that
sprintfunction yields:Thus, you can do the following:
Which prints: