#!/usr/bin/perl use strict; use warnings; use XML::XPath; my $xp = XML::XPath->new(filename => '/xml_test.xml'); foreach my $row ($xp->findnodes('/HOME/Account')) { my $nodeset = $row->find('Record'); foreach my $node ( $nodeset->get_nodelist ) { my $account = $node->find( 'accnumber')->string_value; print "\n $account \n"; } }