foreach my $node ($doc->getChildNodes()) { next unless $node->getNodeType == ELEMENT_NODE; my $child_node = $node->getFirstChild(); my $content = $child_node->getData(); print $content,$/; }