my $max; for my $n ( qw/ 6 3 1 4 7 2 10 5 8 9 / ) { if ( !defined $max || $n > $max ) { $max = $n; } } print "Max: ", $max//"none", "\n";