in reply to memory leak

More details. The infile is actually a list of lists having each sublist a header and two numbers separated by tab. The first loop reads the infile and creates these little arrays associated with each sublist that I called $currentPop. The second loop goes through each array of @ total, splices one randomly chosen element and pushes into @{$RandHapl{$_}}. I then use this following code for printing a new file.

foreach $Population (@total) { print "Population $Population\n"; print OUT "Population $Population\n"; print "$sampleSize{$Population}\n"; for($i = 0; $i < $sampleSize{$Population}/2; $i++) { @pair = splice @{$RandHapl{$Population}}, 0, 2; #print "[@pair]\n"; print "$pair[0][0]\t$pair[1][0]\t$pair[0][1]\t$pair[1][1]\t\n" +; print OUT "$pair[0][0]\t$pair[1][0]\t$pair[0][1]\t$pair[1][1]\ +t\n"; } }

Janitored by davido: Added code tags. Removed br tags from code.