in reply to Sorting - lower to upper

How about this...
erickn@isfe:/home/erickn> cat t use warnings; $hash{John} = ''; $hash{Bob} = ''; $hash{xavier} = ''; $hash{alice} = ''; for my $key (sort {ucfirst($b) cmp lcfirst($a)} keys %hash) { print "$key\n"; } erickn@isfe:/home/erickn> perl t alice xavier Bob John

Replies are listed 'Best First'.
Re^2: Sorting - lower to upper
by shemp (Deacon) on Jul 15, 2004 at 16:30 UTC
    Nope, wont work. Just consider $a = 'amy', $b = 'Ask'. after the case conversion, its comparing then as they were originally, and the capital comes before the lower case.