I can't seem to wrap my brain around how I could do that.
First stab: recursion
#!/usr/bin/env perl use strict; use warnings; use Ref::Util qw/is_hashref/; my $bighr = { foo => 1, bar => { baz => 'quux' } }; my $l = 0; parse_me ($bighr); sub parse_me { my $h = shift; for my $key (keys %$h) { if (is_hashref $h->{$key}) { $l += 4; parse_me ($h->{$key}); $l -= 4; } else { print ' ' x $l . "Key: $key\n"; } } }
There should be enough in there to get you going.
In reply to Re: Traversing a hash of hashes of hashes
by hippo
in thread Traversing a hash of hashes of hashes
by kcorj2244
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |