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
Use a custom sort which first compares the items based on their lowercased representations (so that all variations of "jane" appear before variations of "jim"), then resolves ties by doing a default ASCII comparison (where uppercase comes before lowercase):
perl -e 'print join "\n", sort { lc $a cmp lc $b || $a cmp $b } qw( jim JANE jane JIM )'
Output:
JANE
jane
JIM
jim