(my $max, @vals) = reverse sort @vals; # or sort {$b cmp $a} @vals # in any case, the one to assign to the scalar has to come first