in reply to Dereference array of arrays

G'day monkini,

Some points on the code you posted:

Putting all that together, the code you posted could have been written as:

for (@AoA) { my ($x, $y) = @{$_}[1, 2]; }

Here's my test:

#!/usr/bin/env perl -l use strict; use warnings; my @AoA = ([qw{0.93 a1 b1}], [qw{0.89 a2 b2}], [qw{0.88 a3 b3}], [qw{0.87 a4 b4}], [qw{0.86 a5 b5}]); for (@AoA) { my ($x, $y) = @{$_}[1, 2]; # Now do something with the retrieved values, e.g. print "$x $y"; }

Output:

a1 b1 a2 b2 a3 b3 a4 b4 a5 b5

-- Ken