in reply to Creating a hash of hashes of arrays
Hello estreb, and welcome to the Monastery!
As toolic says, to construct a hash you need to change the braces to parentheses:
my %hash = ( ... ); ... print Dumper(\%hash);
Alternatively, keep the braces (which construct an anonymous hash and return a reference to it) and assign the result to a scalar variable (because a reference is always a scalar value, regardless of the type of thing it refers to):
my $hash_ref = { ... }; ... print Dumper($hash_ref);
Either will give you the output you were expecting. See perlreftut, then perldsc.
Hope that helps,
Update: Fixed typo. Thanks to AnomalousMonk and Anonymous Monk.
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Creating a hash of hashes of arrays
by Anonymous Monk on Dec 15, 2014 at 18:05 UTC |