#! perl -slw use strict; use Data::Dump qw[ pp ]; sub dumpIt { my $r = shift; my $d = shift() // 1; die "'$r' not a hashref" unless ref $r eq 'HASH'; print "{" if $d == 1; for( keys %$r ) { if( ref $r->{ $_ } ) { print chr(9) x $d, "$_ => {"; dumpIt( $r->{ $_ }, $d + 1 ); print chr(9) x $d, "}"; } else { print chr(9) x $d, "$_ => $r->{ $_ }"; } } print "}" if $d == 1; } my %multiLevelHash = ( 'firstSampleKey' => 'SampleValue', 'secondSampleKey' => { 'secondLevelSampleKey' => { 'thirdLevelSampleKeyOne' => 'thirdLevelSampleValue', 'thirdLevelSampleKeyTwo' => 'thirdLevelSampleValue', 'thirdLevelSampleKeyThree' => { 'fourthLevelSampleKey' => 'fourthLevelSampleValue', } } } ); dumpIt( \%multiLevelHash ); __END__ C:\test>junk90 { firstSampleKey => SampleValue secondSampleKey => { secondLevelSampleKey => { thirdLevelSampleKeyTwo => thirdLevelSampleValue thirdLevelSampleKeyThree => { fourthLevelSampleKey => fourthLevelSampleValue } thirdLevelSampleKeyOne => thirdLevelSampleValue } } }