You can only use integers to index arrays, you can only use strings to index hashes.
You can use (paraphrasing your code)
See perldata for much more information.use strict; use Data::Dumper; my %data; my $name = "group 0"; for my $i (0 .. 2) { for my $j (0 .. 3) { $data{$name}[$i][$j] = "group 0 - index $i - $j"; } } print Dumper(\%data); # output follows __END__ $VAR1 = { 'group 0' => [ [ 'group 0 - index 0 - 0', 'group 0 - index 0 - 1', 'group 0 - index 0 - 2', 'group 0 - index 0 - 3' ], [ 'group 0 - index 1 - 0', 'group 0 - index 1 - 1', 'group 0 - index 1 - 2', 'group 0 - index 1 - 3' ], [ 'group 0 - index 2 - 0', 'group 0 - index 2 - 1', 'group 0 - index 2 - 2', 'group 0 - index 2 - 3' ] ] };
In reply to Re: Perl multidimensional arrays with "use strict"
by Joost
in thread Perl multidimensional arrays with "use strict"
by Franck69
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |