Hello Anonymous Monk,
The documentation for XML::Simple states that it should not be used in new code (see the STATUS OF THIS MODULE section). The author recommends alternatives such as XML::LibXML or XML::Twig. Perl XML::LibXML by Example looks like a good resource for getting started with XML::LibXML. Using information that I found there, I put together this example:
#!/usr/bin/env perl
use strict;
use warnings;
use v5.10;
use XML::LibXML;
my $file = 'myxml.xml';
my $dom = XML::LibXML->load_xml(location => $file);
foreach my $lang_set ($dom->findnodes('/DB/termEntry/langSet')) {
my $lang = $lang_set->getAttribute('xml:lang');
foreach my $term_grp ($lang_set->findnodes('./termGrp')){
say '$lang : '. $term_grp->findvalue('./term');
}
}
exit;
I hope you find this helpful.