use strict; use warnings; use Data::Dumper; my %HoH; my $popCt = 4; gener(); print Data::Dumper->Dumpxs([\%HoH], [q{*HoH}]); sub gener { my @chroma = ( 0...10 ); my @chromb = ( 0...10 ); my @ind = ( 0...10 ); for my $pop ( 1 .. $popCt ) { $HoH{$pop} = { individual => [ @ind ], chromasome1 => [ @chroma ], chromasome2 => [ @chromb ], }; } }
This produces
%HoH = ( '4' => { 'chromasome2' => [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], 'chromasome1' => [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], 'individual' => [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] }, '1' => { 'chromasome2' => [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], 'chromasome1' => [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], 'individual' => [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] }, '3' => { 'chromasome2' => [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], 'chromasome1' => [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], 'individual' => [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] }, '2' => { 'chromasome2' => [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], 'chromasome1' => [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], 'individual' => [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] } );
I hope this is of use.
Cheers,
JohnGG
In reply to Re: Hash of Hash Redux
by johngg
in thread Hash of Hash Redux
by BioNrd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |