in reply to maximum amount of data in a variable

If you have not already done so, you might want to include use strict; and use warnings; that might help.