TCL
Calling combined variables (variable inside variable, as in $$hi)
Calling combined variables (variable inside variable, as in $$hi)
The problem with such calling is as follows:
% set a 10
10
% set b$a 12
12
% puts $a
10
% puts $b10
12
% puts $b$a
can't read "b": no such variable
The best way is to avoid it and use an array (as described here) instead of dereferencing (much like using the $hi as a pointer). But the ways include using the "subst" or "eval" commands as shown below
% set hi b$a
b10
% puts $hi
b10
% puts [subst $$hi]
12
% eval puts $$hi
12