Posted to tcl by rmax at Fri Nov 28 11:02:18 GMT 2014view pretty

set script ""
append script "proc manyifs {} {"

# The global state variables that are needed by the ifs.
append script "global foo bar baz"

foreach file $files {
    set fd [open $file]
    append script [gets $file] "\n"
    close $fd
}

append script "}"
eval $script
manyifs