#!/usr/bin/env perl use strict; use warnings; use XML::LibXML; my $dom = XML::LibXML->load_xml(string => <<'EOT'); aaa,aaa bbb,bbb ccc,ccc ddd,ddd eee,eee fff,fff ggg,ggg hhh,hhh EOT my $root = $dom->getDocumentElement; my @records = $root->findnodes("//createnew"); my @kids; push @kids, $_->childNodes for @records; print $_->textContent for @kids; #### aaa,aaa bbb,bbb ccc,ccc ddd,ddd eee,eee fff,fff ggg,ggg hhh,hhh