Questions tagged [hash-of-hashes]

A hash-of-hashes is a multi-dimensional hash that contains nested hashes.

A multi-dimensional hash is a flexible, nested structure where hash values are allowed to be other hashes. This data structure is natively supported by languages such as:

  • Perl
  • Python
  • Ruby

and may be simulated by others.

141 questions
-1
votes
3 answers

perl populating hash of hashes recursively

I have a hash like this: { ABC => [1, 2], 1 => [11, 12,13,14], 13 => [17,20] } I want to generate a hash of hashes like this: (ABC => { 1 => {11 => {}, 12 => {}, 13 => { 17 => {} 20…
Sashi Kiran Challa
  • 905
  • 1
  • 11
  • 21
-2
votes
1 answer

How can I read in a variable/value which is a runtime parameter that is inside a constant list of hashes?

I have tried putting the variables in the string but it reads as blank when I run the program. Here is an example of what I'm working with: use constant { #list will contain more errors ERROR_SW => { errorCode => 727, …
-2
votes
3 answers

Creating a hash of hash in Ruby

I have a hash: hash1 hash1 = Hash.new I have another hash: hash2 hash2 = Hash.new I added the following key-value pair in it: hash2.store("k1","v1") hash2.store("k2","v2") hash2.store("k3",["v3","v4"]) Now, I want to have "key1" in hash1 which…
Anushka
  • 61
  • 6
-2
votes
1 answer

How to get the number of keys in a perl hash of hashes?

I want to get the number of entries for each group, but it seems to be giving me the wrong answer. There are elements in each group that might be repeated. The results I'm getting don't make sense. What am I doing wrong? my %hash; while(<>) { …
user1645240
  • 55
  • 1
  • 7
-2
votes
5 answers

access specific key of a hash of hash in perl?

%HoH = ( Group1=> { member1=> "fred", member2=> "barney", }, Group2 => { member1 => "george", member2 => "jane", }, ); How can I access second value or second key of HoH I want to access member2 of each group keys and…
shaq
  • 799
  • 1
  • 7
  • 12
-3
votes
1 answer

Trying to sort a hash within an array within a hash

This is what my awkward DB looks like atm. I want to try and sort the nested hashes based on age. I've looked around on SO and all i can find is how to sort hashes inside of hashes, but not when the nested hashes are inside of an array. Im sure…
1 2 3
9
10