in reply to Printing Hashes (Without Data Dumper)

Now that you've had a bunch of nice recursive solutions here's an iterative one
my %hash = ( foo => { bar => { baz => 'one', quux => 'two', }, }, field => 'value', this => { that => undef, }, ); my @stack = \%hash; my @path; while(@stack) { my($k,$v); unless( ($k, $v) = each %{ $stack[0] } ) { shift @stack; pop @path; next; } if(ref $v eq 'HASH') { unshift @stack => $v; push @path => $k; } else { print join('/' => @path, $k), " => ", ( defined $v ? $v : "undef" ), "\n"; } } __output__ foo/bar/quux => two foo/bar/baz => one this/that => undef field => value
Not a recommendation by any means, but just another way to do it. It's essentially a recursive approach unrolled which is done by maintaining your own stack and probably quite handy when you're optimizing recursive algorithms (see. Unrolling recursion for more info).
HTH

_________
broquaint