Tcl can confuse many people because of wrong understanding of how it
parses each command before execution. We have a natural inclination to
replace one expression by it's equivalent when doing careless coding and
this could be dangerous.
Let us consider this simple example:
set r rildo set s1 "$r pragana" set s2 {$r pragana}The variables s1 and s2 will have very distinct values, because of value subsititution for $r in the first of them. So, if you assign each of them to another variable, like:
set sn1 $s1 set sn2 $s2total substitution will not occur, and in the sn2 we will have a $r as part of the string.
set sn1 [subst $s1] set sn2 [subst $s2]To make all replacements we wanted to.
Other interesting commands to explore are eval, upvar, and uplevel, but let us leave them for another opportunity...