in reply to Transforming AoA to Hash by Array Slicing
First, please use strict. Your example declares and sets @AoA, then you try to slice @aoa.
AFAIK, rhesa is correct - you need to use something like his code to get what you want. The reason is because the slice @aoa[ 1 ... $#aoa ] returns a list of array references. As per perldata a list evaluated in scalar context returns the last element, and per perlref "the left side of the arrow can be any expression returning a reference". Therefore you dereference only the last element of that list with ->[-1], which yields only a single value for the list in the slice on %uniq. You can use map as rhesa described to dereference each array ref and create a list for the slice on %uniq.
|
|---|