@strings = sort { $b <=> $a } @strings; #### my %code = map { $_ => calculation($_) } @strings; @strings = sort { $code{$b} <=> $code{$a} } keys %code;