in reply to Re^3: Hash of Hash Redux
in thread Hash of Hash Redux
In an ideal world I would have 4 populations with 4 different sets of individuals with 4 different sets of chromosome A and B's. At this point I feel like I am going about this all wrong...use warnings; use strict; use Data::Dumper; my $popCt = 4; my %HoH; for (1 .. $popCt) { my ( $refToArrA, $refToArrB, $refToArrC ) = makeArrays(); &gener(); } print Data::Dumper->Dumpxs([\%HoH], [q{*HoH}]); sub makeArrays { my ($upper, $lower); print 'Enter lower bound: '; chomp ($lower = <STDIN>); print 'Enter upper bound: '; chomp ($upper = <STDIN>); my @chroma; my @chromb; my $ranpop; $ranpop = int rand($upper - $lower + 1) + $lower; print $ranpop . "\n"; my @arrA = ( 1 .. $ranpop ); my $limiter = 50; my @holda; my @holdb; while ($ranpop) { my $genea = int rand ($limiter); push(@holda, $genea); my $geneb = int rand ($limiter); push(@holdb, $geneb); $ranpop--; } my @arrB = ( @holda ); my @arrC = ( @holdb ); return \@arrA, \@arrB, \@arrC; } sub gener { my @newind = @$refToArrA; my @newchroma = @$refToArrB; my @newchromb = @$refToArrC; for my $pop ( 1 .. $popCt ) { $HoH{$pop} = { individual => [ @newind ], chromasome1 => [ @newchroma ], chromasome2 => [ @newchromb ], }; } }
I know strict and warnings are returing things...but I don't know what they mean, google only helps so much.
I really appreciate the help, but tell me if I ask the impossible.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Hash of Hash Redux
by graff (Chancellor) on Nov 01, 2007 at 05:27 UTC | |
by BioNrd (Monk) on Nov 01, 2007 at 13:23 UTC | |
by graff (Chancellor) on Nov 03, 2007 at 04:10 UTC | |
by BioNrd (Monk) on Nov 05, 2007 at 01:05 UTC |