Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Split very big string in half

by pvaldes (Chaplain)
on Apr 15, 2015 at 19:40 UTC ( [id://1123550] : note . print w/replies, xml ) Need Help??


in reply to Split very big string in half

Maybe you are trying to solving the wrong problem here. It seems that what you are looking for is a stream, not a string. To slurp entirely a huge file having 'tie' seems a wrong approach to me. You could run out of memory

How to do this depens on your converter. File::stream, or File::tie could be useful. The idea is to write your big file to a buffer and then feed your converter continuously in smaller chunks. (If you are using bash take a look also to xargs)