The easiest way to dereference, in my opinion, is to always remember that arrays and hashes can only contain scalar values ββ(see perldoc perldata ). That means your array
my @AoA = ( ['aaa','hdr','500'], ['bbb','jid','424'], ['ccc','rde','402']);
... contains only three scalar values, which are links to other arrays. You can write it like this:
my $first = [ qw(aaa hdr 500) ];
With this in mind, itβs easy to imagine (e.g. DVK in your answer) a loop, for example:
for my $aref (@all) {
And knowing that $aref is an array reference, dereferencing is simple:
for my $aref (@all) { for my $value (@$aref) {
In addition, since the values ββin the for loop are smoothed, any changes to them affect the original array. Therefore, if the βprocessingβ in the loop above contains an assignment such as
$value = $foo;
This means that the values ββin @all also changed, just as if you wrote:
$all[0][1] = $foo;
source share