# A two-dimensional array consisting of 4 rows and 3 columns
@matrix=( [ 3 , 4, 0 ], # Each row is an unnamed list
[ 2, 7, 2 ],
[ 0, 3, 4 ],
[ 6, 5, 9 ],
) ;
print "@matrix\n";
print "Row 0, column 0 is $matrix[0][0].\n";
print $matrix[0]->[0];
print "Row 1, column 0 is $matrix[1][0].\n";
print $matrix[1]->[0];
for($i=0; $i < 4; $i++){
for($x=0; $x < 3; $x++){
print "$matrix[$i][$x] ";
}
print "\n";
}
|