|
|
| more useful options | |
| PerlMonks |
Re: sort after first char of hash keyby Cristoforo (Chaplain) |
| on Jun 03, 2011 at 00:38 UTC ( #907901=note: print w/ replies, xml ) | Need Help?? |
|
Here is the Guttman-Rosler Transform.
The advantage of this sort is that it uses a simple alphabetical sort. Its is usually the fastest performing sort. The configuration here will sort any 'alpha'+'number' string, not just a single leading letter plus a number. Update: The setup here is limited to strings of length <= 255. If the strings to be sorted are longer than that, you would have to make some changes. Also, to make the sort case insensitive, which is usually the desired outcome, the first map could be restated as: map { pack "a*Na*C", (map {lc} /(\D+)(\d+)/), $_, length} @list; by adding the lc operator.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||