@array = qw(ABU gubu abu GUBU babu BABU); @array = sort { if (lc($a) eq lc($b)) { $b cmp $a } else { lc($a) cmp lc($b) }} @array; print "@array"; __OUTPUT__ abu ABU babu BABU gubu GUBU
Update: Oops, sorry, missed reliable ordering of same words with different case. This version does it, taking into account that you want lower case before upper case.
In reply to Re: How to sort in this upper / lower case?
by tirwhan
in thread How to sort in this upper / lower case?
by gube
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |