in reply to Hash of Hash Redux
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hash of Hash Redux
by BioNrd (Monk) on Oct 31, 2007 at 18:24 UTC | |
by johngg (Canon) on Oct 31, 2007 at 19:20 UTC | |
by BioNrd (Monk) on Nov 01, 2007 at 00:17 UTC | |
by graff (Chancellor) on Nov 01, 2007 at 05:27 UTC | |
by BioNrd (Monk) on Nov 01, 2007 at 13:23 UTC | |
| |
by GrandFather (Saint) on Oct 31, 2007 at 20:00 UTC |