in reply to OOPs Beginner needs help w/ anonymous array / hash
Hope I understood the problem, but your code really need the <code>...</code> tags!
You don't understand this: push (@{$year_index {$year}}, $rlEntry); so let's analyze it:
In your code is defined %year_index, the prefix % says it's a hash, $year is a scalar; so $year_index{$year} is the element of the hash with key==$year.
This element is a reference to an array, @{...} dereferences it so @{$year_index{$year}} is an array.
In the end the code means: push the scalar $rlEntry into the array referenced by the element of the hash %year_index with key $year.
Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."
|
|---|