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

Hi,

Try changing

if (exists $main_target->{target}->{sub_target})
to
if (exists $main_target->{$target}->{sub_target}) # ^

Hope this helps!


The way forward always starts with a minimal test.