in reply to Dereference array of arrays
A little off-topic, but you should be aware that $a and $b are special variables associated with sort. It's generally considered risky/poor-form to use them outside of that context. Just to help you avoid developing bad habits.
To answer your original question, you could modify your posted code to get
orwhile (@AoA) { my $var = shift @AoA; my $a = $var->[1]; my $b = $var->[2]; }
orwhile (@AoA) { my $var = shift @AoA; my ($a, $b) = @{$var}[1,2]; }
orwhile (@AoA) { my @var = @{shift @AoA}; my $a = $var[1]; my $b = $var[2]; }
or...for my $i (0 .. $#AoA) { my $a = $AoA[$i][1]; my $b = $AoA[$i][2]; }
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|