Sorting Array?



Hi:

New to TCL here and I'm trying the following:

array set lang {0 undefined 1 critical 2 major 3 minor 4 informational
5 ok 81 debug}
#
foreach key [lsort -index 0 [array get lang]] {
puts "$key : $lang($key)"
}


I know that with a hash table I won't get the order out 0, 1, 2, etc..
so I'm sorting first,
however, obviously I'm not doing this correctly because I get:

can't read "lang(critical)": no such element in array
while executing

Which tells me I'm really not doing a key,value pair here. Could
someone point me in the right direction.

Thanks
Tom

.



Relevant Pages

  • Re: multithreaded application freezes
    ... >>> with puts. ... >>> Could you give me some strategy how to debug this. ... >>> in a single thread and it feels that it running longer. ... >>> This is the first time in 10 years a TCL application bites me hard ...
    (comp.lang.tcl)
  • Re: Sorting Array?
    ... New to TCL here and I'm trying the following: ... ok 81 debug} ... so I'm sorting first, ... http://www.deepsoft.com/ -- Web Hosting, with CGI and Database ...
    (comp.lang.tcl)
  • Re: Sorting Array?
    ... puts "$key: $lang" ... so I'm sorting first, ... Rearrange your array set command: ... informational 4 ok 5 debug 81} ...
    (comp.lang.tcl)
  • Re: How to overwrite standard puts method
    ... Robert Klemme wrote in post #950193: ... timestamp and maybe thread id because puts itself only accepts message ... Whenever I need to debug an ant build I use option -d (debug, ... Unfortunately buildR trace is not as useful as ant trace. ...
    (comp.lang.ruby)
  • Converting a Tcl script into C
    ... We have a Tcl script that came with a control system, ... proc doc_available { ... puts "gcs response to login is invalid" ...
    (comp.lang.tcl)