This is slightly tangential to your problem but I wonder whether you might be able to use a single HoH structure in your problem rather than two separate hashes.
use strict; use warnings; use List::Util qw{ max }; use Data::Dumper; my %hashA = ( 11.5 => { 1723478 => 237, 1734789 => 114, 1798761 => 147, }, 11.12 => { 1700123 => 123, }, 11.01 => { 1780345 => 456, }, ); print Data::Dumper->Dumpxs( [ \ %hashA ], [ qw{ *hashA } ] ); delete $hashA{ max keys %hashA }->{ q{1734789} }; print Data::Dumper->Dumpxs( [ \ %hashA ], [ qw{ *hashA } ] );
The output.
%hashA = ( '11.01' => { '1780345' => 456 }, '11.12' => { '1700123' => 123 }, '11.5' => { '1734789' => 114, '1723478' => 237, '1798761' => 147 } ); %hashA = ( '11.01' => { '1780345' => 456 }, '11.12' => { '1700123' => 123 }, '11.5' => { '1723478' => 237, '1798761' => 147 } );
I hope this is useful.
Cheers,
JohnGG
In reply to Re: Hash: Removing a specific value from a multi-valued key
by johngg
in thread Hash: Removing a specific value from a multi-valued key
by eshwar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |