in reply to How to Sort Numerical String
So $arr is sorted on the basis of it's numerical value series (1,2,3,4,..N). In this case N=5, and N can be anything.
No it's not ... if were sorted based on it's numerical value, it would have all the ones up front. At first I thought maybe it was a fielded sort (with fields being separated by dashes) but even that's not the case. I really don't see a real order here. Maybe some type of funky quasi in-situ sort where all the foos are sorted and then all the bars (where the foo and bar relationship is not sorted but keeps the order of the original array).
If that's the case, a simple sort {code foo} @array is not going to do the trick -- you're going to need to break the array into parts based on the second field, sort those arrays and then stitch them back together based on the original order of the second field.
|
|---|