in reply to Printing Hashes (Without Data Dumper)
Output:my @hist; sub print_hash { my($href) = @_; foreach my $key (keys %$href) { if (ref($$href{$key}) eq 'HASH') { my $href2 = $$href{$key}; push @hist, $key; print_hash($href2); pop @hist; } else { foreach my $h(@hist) { print $h."/"; } print "$key => $$href{$key}\n"; } } }
Michele.III => 2 I => 1 II/A => 3 II/B/1 => 4 II/B/3 => 6 II/B/2 => 5
|
|---|