[Melbourne-pm] Hash Containing Array

Jacinta Richardson jarich at perltraining.com.au
Sat Mar 21 19:21:00 PDT 2009

Daniel Pittman wrote:

>>     sub set_acc_via_rule
> [...]
>>             unshift @{$self->{_ACC_VIA_RULE}{$key}},$val;
> You want '$self->{_ACC_VIA_RULE}->{$key}'

FWIW, Perl allows the short-cut Gerd used above, and the two statements:



are equivalent.  This is because if you're looking up an additional key 
(or so), the only thing the left can be returning is a reference and 
thus the second and further arrows can be omitted.  The first arrow is 
of course still always required (when dealing with references).

All the best,


More information about the Melbourne-pm mailing list