I'm getting a Use of uninitialized value error. I don't know if I'm populating my multidimensional array correctly.
my @matrix;
for (my $i=1; $i<=3;$i++){
$matrix[$i][0] = 4;
}
for (my $j=1; $j<=3;$j++){
$matrix[0][$j] = 4;
}
print $matrix[0][0];
I don't understand why this doesn't work. The way I wrote it, the matrix is supposed to populate like so:
1 0
2 0
3 0
0 1
0 2
0 3
use Data::Dumper; print Dumper \@matrix;Please check perldoc.perl.org/perldsc.html#ARRAYS-OF-ARRAYSfor my $i (1..3)is far cleaner and more efficient thanfor (my $i=1; $i<=3;$i++)