in reply to Reading from large files

I would suspect that if you can't load the entire file into an array, you won't be able to load it into a variable.

If you would be a little bit more forthcoming with information, it would make any answers you receive more useful. Given the amount of information you've supplied the answer to "What is a better method for this?" (I took the liberty of correcting punctuation) is more than a bit open-ended.

Two obvious alternatives are reading a record at a time (I shan't try to educate you on loop constructs) and using Tie::File.

emc

" The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents."
—Nathaniel S. Borenstein