use strict;
use warnings;
use XML::Twig;
use Data::Dumper;
my $twig = new XML::Twig();
my $config = $twig->parsefile('invoice2.xml')->simplify();
print Dumper( $config);
####
IT1
Sup1
Org1
description11
description12
101
IT2
Sup1
Org2
description21
description21
101
####
use strict;
use warnings;
use XML::XPath;
use XML::XPath::XMLParser;
my $xp = XML::XPath->new(filename => 'invoice2.xml');
my $nodeset = $xp->find('//Invoices/Invoice');
foreach my $node ($nodeset->get_nodelist) {
my $it = $node->find('InvoiceHeader/InvoiceType')->string_value;
print "IT: $it\n";
my $spn = $node->find('Supplier/Name')->string_value;
print " SPN: $it\n";
my $des = $node->find('InvoiceDetails/BaseItemDetails/Description')->string_value;
print " DES: $des\n";
# ...
# You got the idea, yes?
}