# typical hash-of-hashes: my %hash = ( a => { b => 2 }, c => { b => 4 } ); $hash{$key1}{$key2} = $value;