Hi,
I have a loop which is setting variable names based on the index of the loop like this:
for { set j 1 } { $j <= 3 } { incr j } {
set A$j [ blah blah blah ]
}
this works fine. What I am trying to do now is re-access those variables in another loop later in my script for example:
for { set j 1 } { $j <= 3 } { incr j } {
set newvar [expr $A$j*10.0]
}
the point is that somehow I would like to access the variables $A1 $A2 and $A3 with using a construct like "$A$j".
All of my attempts: $A$j, $A($j), '$A$j' have failed miserably.
Does anyone have any suggestion?
I have a loop which is setting variable names based on the index of the loop like this:
for { set j 1 } { $j <= 3 } { incr j } {
set A$j [ blah blah blah ]
}
this works fine. What I am trying to do now is re-access those variables in another loop later in my script for example:
for { set j 1 } { $j <= 3 } { incr j } {
set newvar [expr $A$j*10.0]
}
the point is that somehow I would like to access the variables $A1 $A2 and $A3 with using a construct like "$A$j".
All of my attempts: $A$j, $A($j), '$A$j' have failed miserably.
Does anyone have any suggestion?