Thank you!

I found something I don't understand, which is forcing me to use the Win32 call method described above. When trying to do a case-insensitive sort by using {uc $_} or {lc $_}, I get different and unexpected results. Here is an example using the same string sets, one upper case, one not.

use feature qw( say ); use Sort::Key::Natural qw( natsort ); say for natsort qw( P007B_YUMYUMNOISESANDTASTING1 P007_YUMYUMNO +ISESANDTASTING5A P007_YUMYUMNOISESANDTASTING5B 007_YUMYUMNOISESANDTAS +TING5C ); say for natsort qw( P007b_YumYumNoisesAndTasting1 P007_YumYumNoises +AndTasting5A P007_YumYumNoisesAndTasting5B P007_YumYumNoisesAndTastin +g5C );

Output:

P007B_YUMYUMNOISESANDTASTING1 P007_YUMYUMNOISESANDTASTING5A P007_YUMYUMNOISESANDTASTING5B P007_YUMYUMNOISESANDTASTING5C P007_YumYumNoisesAndTasting5A P007_YumYumNoisesAndTasting5B P007_YumYumNoisesAndTasting5C P007b_YumYumNoisesAndTasting1

In the first case, the "P007B_" sorts before "P007_". In the second case it sorts after. If I do all lc, it's the same thing, 7b sorts to the beginning instead of the end:

P007b_yumyumnoisesandtasting1 P007_yumyumnoisesandtasting5a P007_yumyumnoisesandtasting5b P007_yumyumnoisesandtasting5c

Anyone understand why? I need it to sort after, but be case insensitive...

Thanks!


In reply to Re^2: Natural Sort / Windows sort problem by cr8josh
in thread Natural Sort / Windows sort problem by cr8josh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.