print "Input values, one per line. When you're done entering the values press the Enter Key on a blank line.\n"; print "\n"; @x = (); while($value = <>) { chomp($value); if ($value eq ""){last;} @x = (@x , $value); } # Input will be counted. $count = 0; foreach $line (@x) { $count++; $count = @x; $sum += $line; } # Error check to make sure user entered at least one value. if ($count < 1) { print "ERROR: You must enter at least one value!\n"; } else { print "You inputed $count value(s).\n"; print "\n"; } &aver; &min; print "The minimuim value of the input is: $min\n"; print "\n"; print "The average of the value(s) you entered is: $av\n"; print "\n"; # This subroutine will take the sum of the input values, divide by the number of values, and return the average. sub aver { $av = $sum / $count; return $av; } # This subroutine will find the minimum value of the user input. sub min { my @num; @num = @_; my $min; $min = $num[0]; foreach $i (@num) { if ($i < $min) { $min = $i; } } } exit;