WordLists::Sort::Typical
'A14' cmp 'A2'; # sadly returns -1, so instead do this: use WordLists::Sort::Typical qw(cmp_alnum); cmp_alnum('A14', 'A2'); # returns 1
This provides functions for sorting text.
Compares alphanumeric values sensibly, e.g. "Unit 10" comes after "Unit 9", not before "Unit 2". Case-insensitive.
Compares alphanumeric values sensibly as cmp_alnum, but ignores all values except alphanumeric characters, so "re-factor" sorts with "refactor", not between "re" and "react". Case-insensitive.
cmp_alnum
Compares alphanumeric values sensibly as cmp_alnum, and considers accented characters to be equivalent to unaccented characters, so "café" sorts with "cafe", not after "caftan".
Compares alphanumeric values sensibly and accent-insensitively as cmp_accnum, and ignores non-alphanumeric content like cmp_alnum_only
cmp_accnum
cmp_alnum_only
Compares version numbers sensibly, even if they are of the form "v1.0028_01a".
This uses a complex_sort, the first stage being cmp_accnum_only. Strings which are still equal are progressively sorted with tie-breakers so that order is reliable. Strings beginning "the " are sorted identically, except at the end, when strings without "the " have preference.
complex_sort
cmp_accnum_only
Case - uppercase comes after lowercase.
Accents - uppercase comes after lowercase.
Non-alphanumeric characters - these are sorted, ignoring other intervening characters.
Definite article - if the strings are otherwise identical, a string beginning "the " comes after a string not beginning "the "
Please use the Github issues tracker.
Copyright 2011-2012 © Cambridge University Press. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install WordLists::Tag, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WordLists::Tag
CPAN shell
perl -MCPAN -e shell install WordLists::Tag
For more information on module installation, please visit the detailed CPAN module installation guide.