The difference is that foreach puts the file read into list context so the entire file has to be held in memory. The while prints as it reads and so will work much better on large files.
Otherwise I like your changes.
In reply to Re (tilly) 3: More efficient munging if infile very large
by tilly
in thread More efficient munging if infile very large
by ybiC
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |