use 5.010; use strict; use warnings; use utf8; use XML::LibXML; my $source_file = 'C:\Users\User\Files\perl\data\example\example.xml'; my $dom = XML::LibXML->load_xml(location => $source_file); foreach my $part ($dom->findnodes('/products/product')) { my $sku = $part->findnodes('sku'); my $download_item_name; my $download_item_name_url; foreach my $downloads($part->findnodes('downloads')){ foreach my $download_group($downloads->findnodes('group')){ foreach my $downloads_group_items($download_group->findnodes('group_items')){ foreach my $download_item($downloads_group_items->findnodes('item')){ $download_item_name = $download_item->findnodes('name'); $download_item_name_url = $download_item->findnodes('url'); print $sku . " -> " . "->" . $download_item_name . "->" . $download_item_name_url . "\n"; } } } } } #### 00123 File 1 www.site.com/path/to/file/file.pdf File 2 www.site.com/path/to/file/file.pdf 00124 File 1 www.site.com/path/to/file/file.pdf File 6 www.site.com/path/to/file/file.pdf 00125 File 7 www.site.com/path/to/file/file.pdf File 2 www.site.com/path/to/file/file.pdf