in tcl, can't read a variable when its name is comprised of another variable

后端 未结 3 951
一向
一向 2020-12-19 21:20

Basically, what I\'m doing is

set i 0

set log_$i \"blah blah\"

puts $log_$i;                  # expecting to see \"blah blah\"

this retur

3条回答
  •  暖寄归人
    2020-12-19 22:07

    Another way of doing is

    ==>tclsh

    % set i 0
    
    0
    
    % set log[set i] bb
    
    bb
    
    % puts "[set log[set i]]"
    
    bb
    

提交回复
热议问题