in reply to Long string needs to be separated

I did a PM search on sysread and came up with a few nodes, one of which may be relevant to your problem (as VSarkiss pointed out, sysread is probably the best solution): EEK! sysread() is expensive!.

You might want to use a multiple of 150 that is closest to 4096, or 4050 (27, 150 byte chunks), and you may be able to reduce some of the associated overhead. Although you'll still need to break it up into 150 byte chunks, you could modify one of the regex solutions provided for that purpose.

A benchmark would be interesting, since I don't know if the gain in speed by increasing the block read might be cancelled out by the additional processing required to break up the 4050 byte string. Unfortunately, I'm at work right now and don't have time to try it myself.

--Jim