Thank you very much for your responses. I have another question.
I would like to replace the second element from hash1 with the second key from %hash2 Where both of the firsts keys match in the two hashes. I shortened the sample data below but there will be a match for each instances of the keys in the complete data. Thanks in advance, Chris %hash1 = { '371' => 2, '33' => 2, '524' => 14, '812' => 54, '955' => 5, '68' => 2, '831' => 34, }; %hash2 = { '105' => { 'Name1' => 1 }, '473' => { 'Name6' => 1 }, '925' => { 'Name5' => 1 }, '840' => { 'Name4' => 1 }, '3' => { 'Name1' => 1 }, '390' => { 'Name6' => 1 }, '146' => { 'Name1' => 1 }, '111' => { 'Name2' => 1 }, '38' => { 'Name2' => 1 }, '356' => { 'Name6' => 1 }, '802' => { 'Name4' => 1 }, '4' => { 'Name1' => 1 }, '528' => { 'Name6' => 1 }, '164' => { 'Name2' => 1 }, '196' => { 'Name1' => 1 }, '807' => { 'Name4' => 1 }, '945' => { 'Name5' => 1 } };