hey guys im having trouble getting my sub. to work. could u help figure out what im doing wrong, pls. i posted the whole program. this time.
print "Input values, one per line. When you're done entering the value +s 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 th +e 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;

In reply to sub min is not working by bjohn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.