in reply to foreach question
The actions will be much the same, but the way it works is rather different: foreach takes a list, which means that before the loop starts the whole of the input file is read, building a list of lines on perl's internal stack and then iterating over that list.
while, on the other hand, reads one line at a time and performs the block on that line before reading the next line. This can use far less memory, and so is usually preferable.
Hugo
|
|---|