$length = length($scalar); $store{$length} .= "$scalar\n"; for ( sort $b <=> $a ( keys ( %store ))) { print "$store{$_}"; }