Wednesday, March 30, 2011

Tcl, Read dynamic variables

I've just solved another Tcl mystery I had from day one in Tcl (around 2 months :)
It was not critical until today!

Example
set qwe.qaz.1 Hello
set qwe.qaz.2 From
set qwe.qaz.3 ShloEmi

set wanted_qaz 3
upvar 0 "qwe.qaz.${wanted_qaz}" wanted_qaz_val
set this_will_be_ShloEmi $wanted_qaz_val

Hope this helps...

2 comments:

  1. this is fantastic !! i ve been looking for this madly !! thanks a lot !!

    ReplyDelete