in reply to Re: Re: Calling nested containers with XML::Simple
in thread Calling nested containers with XML::Simple

Whenever i use 'forcearray', i tend to loop:
for my $snmp (@{$i->{snmp}}) { for my $version (@{$snmp->{version}}) { print "$version\n"; } }
Now, consider XML::XPath, which 'drills down' to the nodes in question:
use XML::XPath; my $xp = XML::XPath->new(filename => 'filename'); my $nodeset = $xp->find('global/snmp/version'); print $_->string_value, "\n" for $nodeset->get_nodelist;
Much nicer. :)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)