split and assign into scalar variables in TCL -
i have variable , want split , assign chunks scalar variables.
example:
variable = vdd_not_gated#7#t i want assign:
net = vdd_net1 layer = 7 border = t i tried following code in tcl :
set variable vdd_not_gated#7#t set fields [split $variable #] foreach field $fields { lassign $field net layer border } puts "$net $layer $border" this doesn't seem working. there other way?
just remove foreach. want this:
lassign [split $variable #] net layer border in older versions of tcl lassign not available used idiom use/abuse foreach:
foreach {net layer border} [split $variable #] {} what thinking when wrote foreach dynamic programming style:
foreach varname {net layer border} value [split $variable #] { set $varname $value }
Comments
Post a Comment