|Keep It Simple, Stupid|
Re: Numeric Sorting on Charactersby johngg (Abbot)
|on Aug 14, 2013 at 21:31 UTC||Need Help??|
Another way is to use a Schwartzian Transform passing the key, an indicator whether the cpu is "-" (1 - TRUE or 0 - FALSE) and the cpu value in an array ref. Sorting can then be done on the indicator first then on cpu value but the second sort term is a ternary so that comparing two items with a "-" cpu value immediately returns zero.
I hope this is of interest.
Update: Ignore this, it doesn't seem to be sorting correctly :-(
Update 2: I was bitten on the bum by a silly precedence problem that should have occurred to me sooner. Replacing
solved the problem.