how to initialize a 2d array in perl
- by Mark
How do I initialize a 2d array in perl?
I am trying the following code:
0 use strict;
10 my @frame_events = (((1) x 10), ((1) x 10));
20 print "$frame_events[1][1]\n";
but it gives the following error:
Can't use string ("1") as an ARRAY ref while "strict refs" in use at ./dyn_pf.pl line 20.
This syntax only seems to initialize a 1d array as print "$frame_events[1]\n" works. Though perl doesn't give any error during the assignment.