in reply to Walking Hash of hash issue?

It may not seem like it, but this is actually an XY problem. "XML::Simple" is dirty bad and wrong. Try using XML::Twig instead. (I think as you said Activeperl, XML::LibXML is unavailable, which would be another good choice generally, and comes bundled with Strawberry perl)

If you're trying to just print every node:

#!/usr/bin/env perl use strict; use warnings; use Data::Dumper; use XML::Twig; my $twig = XML::Twig -> parsefile ( 'data/misc/test.xml' ); foreach my $node ( $twig -> get_xpath ( '//*' ) ) { print $node -> tag, ": ", $node -> text,"\n"; }

Of course, this is a bit of an artificial scenario. You can do something similar to what you've got using "children" and "first_child" instead. But the real question is - what are you trying to accomplish?

Because XML::Simple is probably not the right tool to be using - it has very few redeeming features. Despite the name, it's not simple to use, it can only cope with simple XML

That's why it's officially discouraged, according to the module docs

For the sake of an exact comparison with your code:

print $twig -> root -> first_child_text('name'),"\n"; print $twig -> root -> first_child('profcats') -> first_child_text('na +me'),"\n"; foreach my $element ( $twig -> root -> children ) { print $element -> tag, ": ", $element -> text,"\n"; foreach my $sub ( $element -> children ) { print "\t",$sub -> tag, ": ", $sub -> text,"\n"; foreach my $subsub ( $sub -> children ) { print "\t\t",$subsub -> tag, ": ", $sub -> text,"\n"; foreach my $subsubsub ( $subsub -> children ) { print "\t\t\t", $subsubsub -> tag, ": ", $subsubsub -> +text,"\n"; } } } }

But honestly - I don't think you really need to do that, and one of the alternatives would be better

And whilst we're at it - turn on use strict; and use warnings;