in reply to Re: beginner needs help
in thread beginner needs help

Steps toward getting a useful answer:

It will be ineffective to just ask people to do your homework for you. But the primary reason for the ineffectiveness isn't that people here aren't willing to help. It's that us doing your homework is ineffective at helping you to master the subject matter. Since we're generally aware of that fact, and since this site is geared toward helping people in their quest for knowledge (as opposed to their need to turn in assignments on time), we're often hesitant to just provide the answer when there's little apparent effort. That's just not what we're all about here.

In the case of your problem, I would do this: I would create four variables. One to hold the lowest value entered. One to hold the highest value entered. One to hold the tally of all values entered. And one to keep track of how many values have been entered. I would initially set all the variables to hold 'undef'. Then I would start a loop. I would query for input. I would test for a blank line. Then I would chomp, test for min-ness and max-ness (setting a new min or max if necessary), I would add the input value to the tally, and I would increment the sample count. If I wanted to play it safe I would also reject any input that was non-numeric. After the loop ends I would take care of the math and print the output. Often if you think through the steps, the code becomes easy.


Dave

Replies are listed 'Best First'.
Re^3: beginner needs help
by gcw (Novice) on Mar 22, 2011 at 04:11 UTC

    You can check whether the input is numeric by looking into perl's regular expressions. Hope this helps..

Re^3: beginner needs help
by bjohn (Initiate) on Mar 22, 2011 at 14:14 UTC
    first of all i was not asking u all to do my hw although it may hv appeared that way, sorry. one of my friends told me about this site and i wanted to c if it was for real because our instructor goes very fast and is not always open to questions and i need help some times. so i will come back as i run into issues. thanks guys