use List::UtilsBy qw(max_by); my @list=(0.03,0.04,0.01); my $max=max_by {$_} @list; print "Maximum of ",join(',',@list)," is $max\n";