#!/usr/bin/perl use warnings; use strict; my $a = do {local $/; }; use XML::XPath; use XML::XPath::XMLParser; my $xp = XML::XPath->new(xml => $a); my $nodeset = $xp->findnodes('/OPEN/Info/Other/Id'); foreach my $cid ($xp->findnodes('/OPEN/more/Info/Other')) { my $id = $cid->find('Id'); print "**$id**\n"; } __DATA__ Key CONVERSE1 Number 1 Sum LN WXY12345678 Key CONVERSE2 Number 11 Sum LN 12345678XZW