@haplotypes = (); ## THIS IS AN ARRAY DECLARATION ..... push @{ $haplotypes{ $currentPop} }, [ @temp ]; ## THIS ...........^............^...................is a hash ## with a numeric key, that increments from zero, by 1! #### @temp = split; push @{$haplotypes{$currentPop}}, [@temp]; #### push @{ $haplotypes[ $currentPop ] }, [ split ]; #### @{$TempList{$currentPop};} = (); while (@{$haplotypes{$currentPop};}) { push @{$TempList{$currentPop};}, splice(@{$haplotypes{$currentPop};}, rand @{$haplotypes{$currentPop};}, 1); } @{$haplotypes{$currentPop};} = @{$TempList{$currentPop};}; #### use List::Util qw[ shuffle ]; ## near the top of your program. ... @{ $haplotypes{$currentPop } } = shuffle @{ $haplotypes{$currentPop } }; #### push @total, $currentPop; #### for($i = 0; $i < $sampleSize{$_}/2; $i++) { #### Use of uninitialized value in division (/)...