my $max = pop @{[ sort { $a <=> $b } @vals ]}; #### my $max = $vals[0]; $max = ( $_ > $max ) ? $_ : $max foreach @vals;