I need a little help creating a 2 dimensional matrix in Perl. The matrix needs to contain n ($n) number of rows and n number of columns, and each element needs to be a zero. I have written a piece of code I thought would do this but it does not:
@matrix_row = (map{"0";}(1..$n));
@matrix = (map{\@matrix_row;}(1..$n));
Can someone explain why this does not work and an example of code, using map preferably that would. Thanks in advance!
@matrix_row = (map{"0";}(1..$n));
@matrix = (map{\@matrix_row;}(1..$n));
Can someone explain why this does not work and an example of code, using map preferably that would. Thanks in advance!