balaram baral <
balara...@gmail.com> wrote:
> I am trying to do the below
> set l 0
> set m 0
> set dbout($l)($m) $modelnum
Arjen already posted the explanation (Namely: arrays have only one
dimension, but that can be any string, not just numbers).
My post is to point out what is happening in your example.
% array names dbout
0)(0
The "set" command caused everything between first "(" and last ")"
to be treated as index.
Essentially, you used ")(" as an index separator. This works,
whenever you pass the indexed array name as a single argument to
some command.
> echo $dbout($l)($m)
Retrieval syntax with "$" is a bit more tricky: it tries to find the close
parentheses matching the open parentheses, and hits on the "separator".
You could avoid this either by using a different separator (Arjen
suggested a comma) already when setting the array element,
or use "set" also for retrieving:
puts [set dbout($l)($m)]
Yet another way to avoid the ")(" separator being misinterpreted as
end of index: (not recommended, just for putting the finger on the problem)
set lm "$l)($m"
puts $dbout($lm)