in reply to Pure variable confusion!

You don't appear to have a sub average in your program, where does it come from?

Also , your numbers probably have extra characters you haven't accounted for, you can figure it out if you examine your data by Data::Dump::dd()umpering to visualize your data (lesson courtesy of Basic debugging checklist and brian's Guide to Solving Any Perl Problem )

Replies are listed 'Best First'.
Re^2: Pure variable confusion!
by jmvbxx (Novice) on Apr 21, 2015 at 23:46 UTC

    I did the following the calculate the average:

    my @average = $num_list_total / $size;

    As far as my input goes I'm entering the numbers 1 3 6 7 8 (hitting enter after each) and the CTRL-D

      @average is an array; don't you mean $average? And you have the opposite problem at the end of your program. Your function above_average returns an array, but you have the value assigned to a scalar. I suggest you take the time to learn how to use the debugger. There are links to tutorials in the Tutorials section here. One of the great things about the debugger is you can check the contents of variables to make sure they are what you expect, and you can experiment with alternate code to find the solution.

      Dum Spiro Spero
      Then what is this
      # my $average = average(@_); @average = average(@_);
      Where is sub average?

        That was my confusion. I calculated the average outside of the subroutine and I didn't know how to utilize it within it.

        Thanks for your help!