Perl Monk, Perl Meditation | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I love this site! I was writing my program, had a need for a routine that would do natural sorting, came right to the Monestary and Super Searched for "natural sort", and here I found this code, which worked almost perfectly!
Here is the one problem I have with it, and though I've read the write-up and follow-ups, and I think I get how it works, I can't seem to figure out a solution. The problem is this: If the unsorted members of the list are something like ...
... then this routine will result in a sorted order of ... apple1 apple20 apple ... but what I would expect (and want) would be ... apple apple1 apple20 I thought about going through my list beforehand, and appending something like "00000" to each member that didn't end in a numeric value, and then stripping the "00000" off after the sort, but that seems like a really stupid thing to do. Can someone help me out please? Thanks! In reply to Re: [ Natural Sort ]: Sorting a string with numbers
by blueflashlight
|
|