in reply to I get "not a HASH reference" when parsing an XML file

XML::Simple itself tells you not to use it.

You can use XML::LibXML instead:

#! /usr/bin/perl use warnings; use strict; use feature qw{ say }; use XML::LibXML; my $dom = 'XML::LibXML'->load_xml(location => shift); for my $main_target ($dom->findnodes('/Targets/main_target')) { say "Main Target Name: ", $main_target->findvalue('main_target_nam +e'); for my $target ($main_target->findnodes('target')) { my $target_name = $target->findvalue('target_name'); say "\tTarget Name: $target_name"; say "\t\tSub Target Name: ", $_->findvalue('sub_target_name') for $target->findnodes('sub_target'); } }

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]