Answer: How do I do a natural sort on an array? contributed by tye See RE: RE: Re: Sorting on Section Numbers some important style comments. Features and limitations:
|
Answer: How do I do a natural sort on an array? contributed by tye Bugs and features
|
Answer: How do I do a natural sort on an array? contributed by Dominus I'm not exactly sure what you want (it would have helped if you had provided an example) but here's what I use: This may be more complicated than you need. Given the following: it produces the following output: Lucs St. Louis also suggests: Hope this helps. |
Answer: How do I do a natural sort on an array? contributed by indigo @a = sort @b; |
Answer: How do I do a natural sort on an array? contributed by salva Sort::Key::Natural is fast, can handle numbers of unlimited size and doesn't have problems with unicode:
|
Answer: How do I do a natural sort on an array? contributed by ihb You can use Sort::Naturally. |
Answer: How do I do a natural sort on an array? contributed by Jammerwoch I wrote the following before finding the delightful Sort::Naturally library function. I reccommend using that over what I've done, but maybe people are curious how it might be done. Or maybe someone needs to fine-tune or customize it. The following code is NOT efficient. In particular, the calling of naturalSortInner with $a and $b as arguments completely eliminates the efficiency of having $a and $b. However, it was necessary for the recursive nature of naturalSortInner.
|
Please (register and) log in if you wish to add an answer
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |