in reply to Programmatic access of hashes

my $DATA; my @keys=qw(one two three); # ^--bug in your script I assume # solution 1 eval "\$DATA->{" . join('}{',@keys) . "}= 'value';"; # solution 2 my $d= 'value'; foreach (reverse @keys) { my $x->{$_}=$d; $d= $x; } $DATA->{$keys[0]}= $d->{$keys[0]};

Note that my solution 2 is somewhat senseless. If for example you parse some XML with 'three' and 'threex' below 'two', this simple solution won't work. But in the same sense your parser doesn't make sense to represent all the data as an array.

Usually a parser will parse an xml recursively and the hash will be constructed while descending and ascending the tree. Using a similar method as I was using in solution 2. I would suggest using XML::Twig if XML::Simple is too simple for you.