http://qs321.pair.com?node_id=1202490


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

I am not familiar with the module but in the docs it says:
Spaces, symbols and non-printable characters are only considered for splitting the string into its parts but not for sorting. For instance foo-bar-42 is broken in three substrings foo, bar and 42 and after that the dashes are ignored.
For the examples you give the sort order would then be:
 
P007BYUM
P007YUM 

 
P007Yum 
P007bYum

 
P007byum
P007yum 

 
Which to my mind is correct. You might be able to use some variation of the Schwartzian Transform to achieve your desired output.
  • Comment on Re: Sort::Key::Natural sorting discrepancy