sort { $users{$b} <=> $users{$a} || $a cmp $b } keys(%users)
This will sort first numerically by the values stored in %users and then by the keys of %users. This means that the return value of sort is the keys sorted by data values first, and then alphabetically when both data values are equal.