in reply to Print key when sorting hash by value

Sort the keys by the lengths of the values:
for my $key (sort { length($hash{$a}) <=> length($hash{$b}) } keys %ha +sh) { print "$key : $hash{$key}\n"; }
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Print key when sorting hash by value
by Anonymous Monk on Sep 26, 2014 at 16:18 UTC
    Thanks for your speedy reply! You're the best, thanks!