in reply to Sort::Key::Natural sorting discrepancy

G'day cr8josh,

It's unclear what you want because you haven't shown that.

Piecing together what's in your OP and "Re^2: Sort::Key::Natural sorting discrepancy", it seems you want a case-insensitive sort with underscores sorting before letters. In ASCII, uppercase letters (65-90) come before an underscore (95) which comes before lowercase letters (97-122). If that is indeed what you want, you can do it like this:

$ perl -E ' my @x = ( [qw{P007b_Yum P007_Yum}], [qw{P007B_YUM P007_YUM}], [qw{P007b_yum P007_yum}] ); for (@x) { say $_->[0] for sort { $a->[1] cmp $b->[1] } map { [ $_, lc $_ ] } @$_; say "-" x 3; } ' P007_Yum P007b_Yum --- P007_YUM P007B_YUM --- P007_yum P007b_yum ---

— Ken