nemesisgus has asked for the wisdom of the Perl Monks concerning the following question:
Sorry for the noob question but I couldn't find the answer in existing threads:
I think the common way to generate a Hash of Arrays is using square brackets, something like:
$HoA{$key} = [ @fields ]but this also works:
@{ $HoA{$key} } = @fieldsAre those exactly the same? Is the first preferred over the second for any reason?
I know the second form is used to add elements to the array using push, for instance:
push @{ $HoA{$key} }, @more_fieldsThank you.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hash of arrays generation
by SuicideJunkie (Vicar) on Sep 04, 2012 at 18:17 UTC | |
by nemesisgus (Acolyte) on Sep 05, 2012 at 00:31 UTC | |
|
Re: Hash of arrays generation
by GrandFather (Saint) on Sep 05, 2012 at 01:47 UTC | |
by nemesisgus (Acolyte) on Sep 05, 2012 at 14:56 UTC | |
|
Re: Hash of arrays generation
by VinsWorldcom (Prior) on Sep 04, 2012 at 17:26 UTC |