tcl

How can I repeat $ in TCL language?


My code is

    set a "00"
    set lst$a {1 2 3 4 5}

    puts $lst00
    puts $lst$a   <- it doesn't work

I guess "puts $lst$a" should be converted to "puts $(lst$a) or somthing like that"

What's the answer? Plz help me~

    puts $(lst$a)  <- it doesn't work
    puts $"lst$a"  <- it doesn't work
    puts ${lst$a}  <- it doesn't work

Solution

  • You may use Tcl command "set" to do de-reference. For example:

    puts [set lst$a]  ;# Same as "puts $lst00"