in reply to memory leak
It's not clear what you're trying to accomplish, and your data structures are connected in a strange way that makes it hard to tell. You wrote at the top that you're trying to arrange a two-column file into four columns, but the sample code seems to have no relation to that task.
The code itself has little to guide the reader, and of the two comments, this one is incorrect: @total = (); #this is an array of arraysThe way you use it, it's an array of scalars.
As for the memory problem itself, this line is likely to be the culprit: push @{$RandHapl{$_}}, $temp;This is the first time %RandHapl appears in your code, and you're pushing random elements out of other arrays into arrays hanging from it.
I say "likely to be" because I'm not sure. I also don't know how to tell you to fix it, because I don't know what you're trying to do. If you can add a reply to your original note with some details about the task at hand, you're much more likely to get a good answer.
Update
Added some clarification.
|
|---|