I have an hash and i want to sort based on the keys with upper case words appearing just before the lowercase words.
Example:
JANE
jane
JIM
To get the keys in order, apply sort
with a custom sort function on the keys of the hash.
my %hash = ( JANE => 1, jane => 2, JIM => 3, jim => 4 );
my @sorted_keys = sort {
lc $a cmp lc $b
|| $a cmp $b
} keys %hash;
This custom sort function compares strings first as if they were of the same case, and if equal, takes case into account.