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
2
votes
4 answers

Iterating through a ruby nested hash with nils?

Let say I'm getting back a JSON nested hash (or array of hashes) from an API @example = {"results" = > {{"poop" => "shoop"},{"foo" => {"shizz" => "fizz", "nizzle"=>"bizzle"}}} YAML markup for the nested hash above - poop: shoop - foo: …
thoughtpunch
  • 1,907
  • 4
  • 25
  • 41
2
votes
0 answers

KECCAK-256 Hash function in VB6 Or VBA

why keccak-256 is not the chilkat hash olgaritm ? Dim crypt As New ChilkatCrypt2 crypt.EncodingMode = "hex_lower" crypt.HashAlgorithm = **"keccak-256"???** Dim bdSeed As New ChilkatBinData success =…
2
votes
3 answers

how to make a deep_slice in a hash on ruby

I was looking around for a clean way to do this and I found some workarounds but did not find anything like the slice (some people recommended to use a gem but I think is not needed for this operations, pls correct me if I am wrong), so I found…
r4cc00n
  • 1,927
  • 1
  • 8
  • 24
2
votes
1 answer

Multidimensional array or hashes in Perl. Access items

Newbuy's question. I have json file which looks like this: { "Controllers":[ { "Command Status" : { "Controller" : 0, "Status" : "Success", "Description" : "None" …
wsdx
  • 145
  • 1
  • 1
  • 8
2
votes
3 answers

Why does my multi-leveled hash print the way I expect?

Here's the code and its not working, What I am trying to do is to pass Hash of Hashes to subroutine aka function, but it gives some odd output. my %file_attachments = ( 'test1.zip' => { 'price' => '10.00', 'desc' => 'the 1st test'}, …
Xomo
  • 91
  • 1
  • 7
2
votes
1 answer

How would I delete hash keys only when the key has no values?

I have built a loop that finds all of the VMDKs for a perticular VM and then create a hash of the output, then it tests whether the disk is actually present by looking for a parameter in the VMX file. Then if the disk is not present it deletes it…
AtomicPorkchop
  • 2,625
  • 5
  • 36
  • 55
2
votes
2 answers

Parallel::Forkmanager -> populate a hash of hashes of arrays from child processes

I have this piece of code that I'd like to parallelize (for reference): my (%fastas, %counts); foreach my $sample ( sort keys %AC2 ) { foreach my $chrom (sort keys %{ $AC2{$sample} } ) { foreach my $pos ( sort { $a <=> $b } (@{…
2
votes
2 answers

Creating hash of hash dynamically in perl

I am trying to create a hash of hash of - the nesting depth depends on the number of arguments passed into @aGroupByFields array. In the below implementation, I am getting the desired hash structure.But I have hard coded the fields [ example -…
Soumya
  • 885
  • 3
  • 14
  • 29
2
votes
2 answers

Perl Hash of Hashes, get lowest numeric key

I have a hash of hashes where the first key is a string and the second key is an integer. I'm trying to get the lowest second key in the hash of hashes. Here's my hash. %HoH = ( flintstones => { 8 => "fred", 4 => "barney", …
cooldood3490
  • 2,418
  • 7
  • 51
  • 66
2
votes
1 answer

How to get the key associated with a hash reference's key in a hash of hashes?

In an attempt to help me learn Perl, I built the following data structure, where the inner hash (/DriveA/archive, etc.) is a hash reference: #The contents of the %properties hash of hashes #The inner hash is a hash reference to a hash named…
user2063351
  • 503
  • 2
  • 13
  • 31
2
votes
2 answers

Perl:Access values of hash inside a hash

I have just picked up Perl. I have a little confusion with accessing hash values. Below is the code where I am trying to access the values of a hash inside a hash. Since am using a simple text editor to code, I am not able to figure out what can…
D_D
  • 383
  • 2
  • 5
  • 18
2
votes
3 answers

How to extract key name from a hash of hash?

I have following hash of hash : %HoH = ( flintstones => { husband => "fred", pal => "barney", }, jetsons => { husband => "george", wife => "jane", his boy => "elroy", }, simpsons => { husband => "homer", …
Dcoder
  • 379
  • 2
  • 7
  • 13
2
votes
1 answer

Sorting Hash of Hashes by value

I have the following data structure my %HoH = { 'foo1' => { 'bam' => 1, 'zip' => 0, }, 'foo2' => { 'bam' => 0, 'zip'…
cooldood3490
  • 2,418
  • 7
  • 51
  • 66
2
votes
1 answer

Perl accessing the elements in a hash/hash reference data structure

I have a question I'm hoping you could help with as I am new to hashes and hash reference stuff? I have the following data structure: $VAR1 = { 'http://www.superuser.com/' => { 'difference' => { …
yonetpkbji
  • 1,019
  • 2
  • 21
  • 35
2
votes
1 answer

Handling complex hashes in perl

I have simple perl script as below: #!/usr/bin/perl use strict; use Data::Dumper; my %x; $x{"a"}="b"; $x{"b"}={'c'=>3,'d'=>4}; $x{"c"}={'e'=>{'f'=>5,'g'=>6},'h'=>{'i'=>7,'j'=>8}}; print Dumper(%x); This is outputting me as below: >…
user1939168
  • 547
  • 5
  • 20
1 2
3
9 10