use strict; use XML::LibXML; my $dom = XML::LibXML->new->parse_file('XMLS/PXMLStatusMessage.xml'); my $root = $dom->getDocumentElement(); my @node = $root->findnodes("//partnerContact/companyName"); my $all; foreach (@node) { &traverse($_, \$all); } print "DEBUG:\n".$all; sub traverse { my ($node, $all) = @_; if ($node->getType == XML_ELEMENT_NODE) { $$all .= "<", $node->getName, ">\n"; print "<", $node->getName, ">\n"; foreach my $child ($node->childNodes()) { &traverse($child,$all); } $$all .= "getName, ">\n"; print "getName, ">\n"; } elsif ($node->getType() == XML_TEXT_NODE) { $$all .= $node->getData."\n"; print $node->getData."\n"; } } #### Useless use of a constant in void context at ./myparse.pl line 31. Useless use of a constant in void context at ./myparse.pl line 36. Planet Internet DEBUG: