in reply to OOPs Beginner needs help w/ anonymous array / hash
I'll try an explanation:
push (@{$year_index {$year}}, $rlEntry)
%year_index is a hash, and you access the pair with key $year.
If there's already an array reference stored in $year_index{$year}, it pushes the value $rlEntry to this array. If not, it creates a new array, stores $rlEntry there, and stores the new array in $year_index{$year}.
This feature is called autovivification.
See also perlreftut on how the nested data structures and their syntax work.
|
|---|