开发者

how to push multiple values into an array in TCL

开发者 https://www.devze.com 2022-12-07 21:15 出处:网络
I am trying to append the values to an array as below and it is not appending to the value list while {[gets $fp line] != -1} {

I am trying to append the values to an array as below and it is not appending to the value list

while {[gets $fp line] != -1} {

    if { [regexp {Path Group: (\w+)} $line all group]} {
        set hash($group) {}
 
    } elseif {[regexp {开发者_开发知识库\(VIOLATED\)\s+(-[0-9]*.[0-9]*)} $line all slack]} {
        puts "slack $slack\n"
         lappend hash($group) $slack     
    }

 }

parray hash

The output of the array hash is only the last value of the iteration bit not a list

expecting

Name { X Y Z} Age {3 4 5:}

0

精彩评论

暂无评论...
验证码 换一张
取 消