I am working on a requirement in which keys of hash are hash. I came across the cpan modue Tie::RefHash
which can do the job, but somehow it is not working for nested hashes even though I am using Tie::RefHash::Nestable
.
my %hash_arg = ();
tie %hash_arg, 'Tie::RefHash::Nestable';
my $hash = { 'mnp' => 1 };
%hash_arg = (
'pqr' => {
'a;' => 1,
'i' => 1,
'mn' => 1,
'c' => 1,
$hash => 1
}
);
Hash %hash_arg
has a key pqr
whose value is a reference to a hash, which has a further hash as a key. When I loop over keys of pqr
and try to use the ref
function to figure out the hash, it doesn't work.