#!/usr/bin/perl use Data::Dumper; $hohref = {}; $hohref->{"h1"}={}; $hohref->{"names"}={"name1"=>"Chandra"}; $epout = rand(9); $tcid = substr($epout,4,9); $hohref->{$tcid}={"TCDesc" => "Login Test", "TCRun"=>"Yes","TCResult"=>"Pass"}; #Dereferencing Hash of Hashes using foreach loops foreach my $k1 (keys %$hohref) { print "The key outer hash $k1 The value outer hash $hohref->{$k1}\n"; if (ref($hohref->{$k1}) eq "HASH") { foreach my $k2 (keys %{$hohref->{$k1}}) { print "The key is $k2 ===> The value is $hohref->{$k1}->{$k2}\n"; } } } #Dereferencing using Dumper function is working print Dumper($hohref),"\n";