Nested hash itself


Is there a way to create a nested hash with the same hash?

if I have a hash h1 = {‘key’ => ‘value’}

Can I do that h1[‘abc’] = h1
so I will end up with the following hash h1 = ( ‘abc’ => {‘key’ => ‘value’}}


Found it

I need to clone the hash

tmph = {}
tmph[key] = h.clone
h = tmph.clone