use strict; use warnings; use XML::TreeBuilder; my $xmlDoc = < ... XML my $root = XML::TreeBuilder->new (); $root->parse ($xmlDoc); my @authors = $root->look_down (_tag => 'Author'); for my $authorElt (@authors) { my ($lastName) = $authorElt->look_down (_tag => 'LastName'); my ($foreName) = $authorElt->look_down (_tag => 'ForeName'); next unless defined $lastName and defined $foreName; print $lastName->as_text (), ', ', $foreName->as_text (), "\n"; } #### van Beilen, J B Penninga, D Witholt, B Wilde, A Reaves, B Banting, G