I'm currently writing scripts to read pipe-separated values from a very large text file (160+ GB). It's necessary to process every line, but this approach:
@lines = <BIGGUNFILE>
is unfeasible due to memory requirements.
Currently the scripts use standard line by line behavior:
while(my $line = <BIGGUNFILE>)
I assume that this is pretty inefficient since it should cause a lot of very small reads instead of reading the data in large chunks.
I've also experimented with Tie::File, which reports that it will buffer data, but this too seems to be line by line. I only need to process each line once, so buffering this way doesn't help me much.
Is there another approach in Perl wherein I can read in larger chunks of data at a time, but yet not slurp in the whole file? In other words, I'd like to read-ahead and buffer a set of X lines so that the IO would be faster...