use strict; use warnings; use XML::Twig; my $XML = XML::Twig->new( twig_roots => { 'element' => sub { for my $child ($_->cut_children()) { $child->print(); print "\n"; } } }, pretty_print => 'indented' ); $XML->parse(*DATA); print "\n"; __DATA__ OneTwo