in reply to finding highest number
ps: code is not testedif (scalar(@numbers) > 0) { # compare only when array has entries my $highest = $numbers[0]; # set startvalue foreach my $compNum (@numbers){ # compare all numbers in array $highest = $compNum if ($compNum > $highest); } } else { # nothing to compare }
|
|---|