Posted to tcl by Bradipo at Mon May 07 19:44:52 GMT 2012view pretty

Here's a section of code that is giving strange errors:

    foreach name [lsort [array names a]] {
      append bstring "\"[lindex $a($name) 0]\","
    }
    # some more code that does not alter a...
    foreach name [lsort [array names a]] {
      append bstring "'[join [lrange $a($name) 1 end]]',"
    }
    puts $bstring
    unset a

When this script is evaluated, I get this error:

can't unset "a": no such variable