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 ] ];
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Adding to hash that contains an array of arrays
by eppo (Novice) on Jan 29, 2014 at 20:34 UTC | |
by FloydATC (Deacon) on Jan 30, 2014 at 12:39 UTC |
In Section
Seekers of Perl Wisdom