Updated 2013-08-15 10:34:00 by RLE

This command is part of the TclX package.
for_file var filename code

This command implements a loop over the contents of a file. For each line in filename, it sets var to the line and executes code.

Here's how to redo it in pure-Tcl:
 proc for_file {varName filename body} {
    upvar 1 $varName var
    set fp [open $filename]
    while {[gets $fp var]>=0} {
       uplevel 1 $body
    close $fp
 } ;#

break and continue support would need some extra action, compare do...until in Tcl.