On a sidenote I ran out of memory if I used a simple while loop, which surprised me as that shouldn't slurp the file as say a foreach?A while loop seems fine to me. It should not slurp all the contents into memory. This prints the 10 millionth line ($.) of a 187M line (2GB) file for me in about 3 seconds:
while (<>) { if ($. == 10_000_000) { print; last; } }
In reply to Re: Speed and memory issue with large files
by toolic
in thread Speed and memory issue with large files
by firmament
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |