I remembered somewhre in the forum about double substitution , but could not find it. Here is my problm,
I used a global variable to store variable names which I will use in a function.but I have problem to get the value of the variable.
set a1 1
set a2 2
set var(0) a1
set var(1) a2
proc printvar {varNum} {
global var
puts "$$var($varNum)"
}
when I ran "printvar 0", it prints "$a1" instread of 1. How should I solve this problem.
Thanks
I used a global variable to store variable names which I will use in a function.but I have problem to get the value of the variable.
set a1 1
set a2 2
set var(0) a1
set var(1) a2
proc printvar {varNum} {
global var
puts "$$var($varNum)"
}
when I ran "printvar 0", it prints "$a1" instread of 1. How should I solve this problem.
Thanks