Usage:
Used when we have to change the value of a global variable
from inside a procedure’s scope
Example
proc example {one two} {
upvar $one local1
upvar $two local2
set local1 Kavitha
set local2 Anbarasu
}
set glob1 David
set glob2 Beckam
puts $glob1
puts $glob2\n
example glob1 glob2
puts $glob1
puts $glob2
Output
DavidBeckam
Kavitha
Anbarasu
In the above example we are able to change the value of two global variables glob1 and glob2 from within a procedure