$a
如果是数组数组,则以下代码有效,但我需要$a
成为数组数组的引用。
问题
我如何迭代$a
?
#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;
my @AoA = ( ['aaa','hdr','500'],
['bbb','jid','424'],
['ccc','rde','402'],
);
my $a = \@AoA;
my $s = "bbb";
my $d = "ddd";
for my $i ( 0 .. $#a ) {
for my $j ( 0 .. $#{ $a[$i] } ) {
if ($a[$i][$j] eq $s) {
$a[$i][$j] = $d;
last;
}
}
}
print Dumper $a;