use strict; use warnings; use Data::Dumper; use XML::Simple; my $xml = q{ 1234 Box Suitcase }; my $struct = XMLin( $xml, ForceArray => 1 ); dumpit( $struct ); my $MajorItems_aref = $struct->{MajorItems}; dumpit( $MajorItems_aref ); my $SecondMinorItem_href = $struct->{MajorItems}[1]; # or $MajorItems_aref->[1] dumpit( $SecondMinorItem_href ); my $MinorItem_aref = $struct->{MajorItems}[1]{MinorItem}; # or $SecondMinorItem_href->{MinorItem} dumpit( $MinorItem_aref ); my $MinorItemFirst_href = $struct->{MajorItems}[1]{MinorItem}[0]; # or $MinorItem_aref->[0] dumpit( $MinorItemFirst_href ); my $Item_aref = $struct->{MajorItems}[1]{MinorItem}[0]{Item}; # or $MinorItemFirst_href->{Item} dumpit( $Item_aref ); my $luggage = $struct->{MajorItems}[1]{MinorItem}[0]{Item}[0]; # or $Item_aref->[0] dumpit( $luggage ); sub dumpit { print Dumper( $_[0] ); }