cr8josh has asked for the wisdom of the Perl Monks concerning the following question:
Sort::Key::Natural seems to have different results based on capitalization. First letter uppercase sorts differently than both all upper and all lower case
use feature qw( say ); use Sort::Key::Natural qw( natsort ); say for natsort qw( P007b_Yum P007_Yum ); say qw(---); say for natsort qw( P007B_YUM P007_YUM ); say qw(---); say for natsort qw( P007b_yum P007_yum );
Output:
P007_Yum P007b_Yum --- P007B_YUM P007_YUM --- P007b_yum P007_yum
In the first case (uppercase first), the "P007b_" sorts after "P007_". In the other cases (all upper or all lower), it sorts after. As a result, I can't do case-insensitive sorting without changing the results. Can any monks help?
Thanks!
Back to
Seekers of Perl Wisdom