(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 #### my $max = pop(@vals = sort(@vals)); #### use List::Util 'maxstr'; my $max = maxstr(@vals);