my @list = sort { ( ($b eq $first) <=> ($a eq $first) ) or ( lc($a) cmp lc($b) ) or ( $a cmp $b ) } keys %$hash;