use strict; use warnings; my $num_of_external = 30; #num moms my @num_of_internal = (30, 40, 20, 30, 40, 30, 40, 20, 30, 40, 30, 40, 20, 30, 40, 30, 40, 20, 30, 40, 30, 40, 20, 30, 40, 30, 40, 20, 30, 40); #num offspring per mom my $num_of_super_internal = 10; #num genes tracked #during shuffle 5 come from dad 5 come from mom for (1 .. $num_of_external) { my $internal = shift @num_of_internal; #additional things here. #i.e. select mother from possible pool for (1 .. $internal) { #select father for each offspring #additional things here. for (1 .. $num_of_super_internal) { #additional things here. #select genes and shuffle around between mom and dad. } } }