http://qs321.pair.com?node_id=1072575


in reply to Adding to hash that contains an array of arrays

Here is some code that I think produces the data structure you want. However it sounds like there may be a better structure or approach to achieve the desired result. Perhaps if you provide more of your code and a clearer description of what you are trying to achieve we may be able to offer more helpful suggestions.

use strict; use warnings; use Data::Dumper; my %hash; for my $i ( 1 .. 3 ) { my @array; for my $j ( 1 .. 3 ) { push @array, $j; } push @{ $hash{ID} }, \@array; } print Dumper( %hash );
Output $VAR1 = 'ID'; $VAR2 = [ [ 1, 2, 3 ], [ 1, 2, 3 ], [ 1, 2, 3 ] ];