thank you for all your help! I used the same workaround (working with different chunks), albeit nowhere near as elegant as that - I will use this from now on.
(I am on a 64 bit machine - I just had thought that when using a 64 bit version of perl everything would be running on 64 bits.)