Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tcl set Problem

Status
Not open for further replies.

chelox33

Programmer
Mar 30, 2016
1
0
0
AR
Hi!

I want to assign to the "data" variable the content of "test$i_input", where "i" is an index variable, for example i= 0 to 5.

>set i 0
0
>set test\$index_input 33
33

But I have the next error:

>set data $test\$i_input
can't read "test": no such variable

How I can do correctly this assignation?

Thanks!
 
Hi

You are messing with 3 variables ( i, index_input and i_input ) in your sample code, so is possible to misunderstood your intention, but I think this is what you want :
Code:
set index_input 22

set test$index_input 33

set data [set test$index_input]
Here the variable that stores value 33 is called test22.


Feherke.
feherke.ga
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top