| Start |
|---|
| Reading files: foreach vs. while When reading a potentially large file, a The diamond operator does some magic here to make sure the loop only terminates at end-of-file and not e.g. on lines that contain only a "0" character. The following loop seems to work just the same, however it evaluates the diamond operator in list context, causing the entire file to be read in one go: If you are operating on one record at a time anyway, this can result in a huge waste of memory and should thus be avoided. |
| Processing long lists If you have a list in memory already, the straightforward and usually sufficient way to process it is a simple This is fine e.g. for the common case of doing some processing on Unless a reference to |
Read Article
https://develop.horje.com/learn/1434/reference