If you are using 8.6:
    lsort -stride 2 -index 1 -integer {carrot 10 apple 50 banana 25}
returns: “carrot 10 banana 25 apple 50”.

array get will return a list of key value...


 
On 2/27/14, 6:10 PM, David Wang wrote:
Hi Thanks to Donal for his recommendation to change

from set sizes [array names sizeNum] to set sizes [lsort -ascii [array names sizeNum]]

Now I wonder how do I sort based on sIdx ? meaning, I would like it to come out the same
order as inserted. This will solve my problem period.


From: David Wang <kuoweiwang@yahoo.com>
To: "tcl-gsoc@lists.sourceforge.net" <tcl-gsoc@lists.sourceforge.net>
Sent: Wednesday, February 26, 2014 5:58 PM
Subject: New to tcl

Hi

I have the following code in tcl and I am new to this language.
Say the following lines get inserted
reset
tW
failure

// used to insert the lines above
foreach f [$par listof names] {
  set sizeNum($f) $sIdx             
  incr sIdx
}

However, this following code prints out the lines in a different order
failure
reset
tW

set sizes [array names sizeNum]
foreach s $sizes {
set sIdx $sizeNum($s)
    addlines "[$s cget -name]"
}

Is there a way I can find out what hashing function it uses to
print out the lines in the order it is?

Thanks

David                                     




------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk


_______________________________________________
Tcl-gsoc mailing list
Tcl-gsoc@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tcl-gsoc


-- 
+------------------------------------------------------------------------+
| Gerald W. Lester                                                       |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+