更新时间:2022-06-19 09:25:24
要创建数组数组,或者更准确地说是数组引用数组,请尝试以下操作:
To make an array of arrays, or more accurately an array of arrayrefs, try something like this:
my @array = ();
foreach my $i ( 0 .. 10 ) {
foreach my $j ( 0 .. 10 ) {
push @{ $array[$i] }, $j;
}
}
它为您将值推送到取消引用的 arrayref 上.您应该能够访问这样的条目:
It pushes the value onto a dereferenced arrayref for you. You should be able to access an entry like this:
print $array[3][2];