The stupid question is the question not asked | |
PerlMonks |
Re: hash array questionby Eily (Monsignor) |
on Nov 08, 2019 at 16:53 UTC ( [id://11108481]=note: print w/replies, xml ) | Need Help?? |
Where does the first hash come from? Maybe there's a way to get the data directly in the format you want, if the intermediate format (your first one) is useless. Otherwise something like this might help:
Edit: this is really straightforward, so maybe the information your are missing is how to work with references (a hash within a hash is actually stored through a reference, ie an hashref). Edit 2: oh ++choroba is right, you can't just have multiple values for the same key. You need an intermediate array. Thanks to the magic of autovivification you can just write: push @{ $hash{$key} }, $value to add a new $value to the array stored at $key (and created it if needed).
In Section
Seekers of Perl Wisdom
|
|