我的脚本中有以下代码段:
set line [gets stdin]
set $line1 $line
这是错的吗?我基本上想将变量的值复制line
到line1
。它给我错误:
can't read "line1": no such variable
while executing
"set $line1 $line"
在tcl中,在$
变量前加上该变量的值。因此,正确的语法是:
set line1 $line
这几乎与*
C中的语义相同:在C*
中的指针之前会将其解引用为其值。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句