;# Using eval on a single command: set cmd {puts "Evaluating a puts"} puts "CMD IS: $cmd" eval $cmd ;# Using eval to define a proc if {[string match [info procs tempFileName] ""] } { puts " Defining tempFileName for this invocation" set tmpFileNum 0; set cmd {proc} lappend cmd tempFileName lappend cmd "" lappend cmd {global tmpFileNum; incr tmpFileNum; return "/tmp/TMP.[pid].$tmpFileNum"} puts "CMD: $cmd" eval $cmd } puts " The body of tempFileName is: [info body tempFileName] " puts "tmpFileName returns: [tempFileName]" puts "tmpFileName returns: [tempFileName]"