in reply to Alternatives to split?

I may be way out in left field here, but I have a suggestion that may help you to avoid abandoning the Perlish use of split. I'm surprised it hasn't been offered yet. ...maybe it's because I AM in left field. ;)

If your data is truly pipe delimited, perhaps you should read it in using the pipe as the record separator. Before slurping in this long datafile, add the line  $/ = "|"; prior to your file read. Then put your file read into a loop, and be sure to either process each line individually, or slurp it into an array now instead of a scalar. After you're done reading in the file, just to retain your sanity, change  $/ back to  "\n".

That's going to serve the function of having the file read already split your file on "|". Now you can process each pipe delimited line on its own as a much smaller, easier to use chunk.

Read the file in pre-split. Come to think of it, this does abandon the Perlish split, in favor of an even more Perlish approach (IMVHO).

I hope this helps.

Dave

"If I had my life to do over again, I'd be a plumber." -- Albert Einstein