in reply to Script for MAX and Min
if you insist on scalars or literals put them in the for loop.for $nums (@numset){ $min = $nums unless ($min); $max = $nums unless ($max); $max=$nums if ($nums > $max); $min=$nums if ($nums < $min); $total += $nums; ++$count; } print"Minimum: $min","\nMaximum: $max\n","Average: ",$total/$count;
for $nums ($first,$second,$third,$forth) or for $nums (123,32,7,-12,-23,17)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Script for MAX and Min
by merlyn (Sage) on Oct 04, 2001 at 02:24 UTC |