use strict; use warnings; use Data::Dumper; use XML::Twig; my $xfile = < headline 1 headline2 EOF my $t = new XML::Twig(); $t->parse($xfile); my @x; for my $item ($t->root()->children('item')) { push @x, $item->first_child('i')->text(); } print Dumper(\@x); __END__ $VAR1 = [ 'headline 1', 'headline2' ];