how to push multiple values into an array in TCL
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:}
精彩评论