in reply to How to sort in this upper / lower case?

@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.


A computer is a state machine. Threads are for people who can't program state machines. -- Alan Cox