use XML::Twig; my $file = 'sample.xml'; my $twig = XML::Twig->new(); $twig->parsefile($file); my $root = $twig->root; foreach my $species ($root->descendants('Ss')) { print $species->att('ssId'); print "\t"; print $species->att('handle'); print "\t"; print $species->next_sibling_text('Observed'); print "\n"; }