in reply to Re: Parsing a dataset into an arbitrary sized hash of hashes
in thread Parsing a dataset into an arbitrary sized hash of hashes
The problem seems to be the absence of types in Perl: if DiveVal encounters a number, it creates an array for you, not a hash:
:) The documentation disagrees -- you can specify \2 if you want to force hash keys
Note that all 'keys' that work for arrays also work for hashes. If you have a reference that is overloaded such that it can both act as an array reference and as a hash reference or, in the case of DiveVal() and DiveRef(), if you have an undefined $ref which can be autovivified into either type of reference, then numeric-looking key values cause an array dereference. In the above cases, if you want to do a hash dereference, then you need to pass in a reference to the key.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Parsing a dataset into an arbitrary sized hash of hashes
by choroba (Cardinal) on Apr 02, 2014 at 23:46 UTC | |
by DunLidjun (Acolyte) on Apr 04, 2014 at 14:06 UTC |