in reply to out of memory!

Intriguing. You use $i here: for ($i=0;$i<=(scalar(@blocks));$i++)

But then use $index here: if($blocks[$index]=~m/^\d/) ?

i have successfully executed scripts larger than this one,

It isn't the size of the script that counts; it is the size of the data.

And as you haven't shown us how you are populating @blocks; nor told us how big that array is, there is nothing we can to to help you.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.