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

  1. Here's a section of code that is giving strange errors:
  2.  
  3. foreach name [lsort [array names a]] {
  4. append bstring "\"[lindex $a($name) 0]\","
  5. }
  6. # some more code that does not alter a...
  7. foreach name [lsort [array names a]] {
  8. append bstring "'[join [lrange $a($name) 1 end]]',"
  9. }
  10. puts $bstring
  11. unset a
  12.  
  13. When this script is evaluated, I get this error:
  14.  
  15. can't unset "a": no such variable
  16.