use strict; use warnings; use XML::Twig; my $twig=XML::Twig->new( twig_handlers => { 'Hierarchy' => \&print_elt_text } ); $twig->parsefile( "a.xml"); sub print_elt_text { my( $t, $section)= @_; ? $t->purge; } #### 1.0 root Enable Disable root root 900 root