my %hash = ( '103496-1' => [{ 'CLVD' => '5678', 'COMP' => '1234', 'FD' => '0010', 'Files' => [{'File' => 'text.txt', 'hash' => 'a538346ad3485'},{'File' => 'text2.txt', 'hash' => '237d97892376a'}] }] ); print Dumper(%hash); print "\n"; my %newhash; my $fn; foreach $fn (values %hash) { $newhash{$fn->{COMP}}= $fn; delete $fn->{COMP}; } print Dumper(%newhash); print "\n"; #### Pseudo-hashes are deprecated at hashofhash.pl line 18. Use of uninitialized value in hash element at hashofhash.pl line 18. Pseudo-hashes are deprecated at hashofhash.pl line 19. $VAR1 = ''; $VAR2 = [ { 'FD' => '0010', 'COMP' => 1234, 'CLVD' => '5678', 'Files' => [ { 'hash' => 'a538346ad3485', 'File' => 'text.txt' }, { 'hash' => '237d97892376a', 'File' => 'text2.txt' } ] } ];