use Data::Dumper; use strict; use XML::Twig; my $xml_twig = XML::Twig->new( pretty_print => 'indented', NoLWP => 1, discard_spaces => 1, ); $xml_twig->parse ( \*DATA ) || die "\nError parsing data $@\n"; my $struct=$xml_twig->simplify( noattr => 1 ); print Dumper($struct); __DATA__ hello1 hello2 hello3