Two dimensional matrices
2020-04-21 本文已影响0人
余绕
@probes=( #array with Anonymous array @开头,用()括起来
[1,3,2,9],
[2,0,8,1],
[5,4,6,7],
[1,9,2,8],
);
print "the probe at row 1,column 2 has value ",$probes[1][2],"\n";
$pro=[ #Anonymous array with anonymous arrays 必须$开头,用[]括起来
[1,3,2,9],
[2,0,8,1],
[5,4,6,7],
[1,9,2,8],
];
print "the probe at row 3,column 2 has value ",$$pro[3][2],"\n"; #引用要用$$或者下面方式$pro->[$i][$j]
print "the probe at row 3,column 2 has value ",$pro->[3][2],"\n";