Assignments (as in "@product = ...;") replace the current contents of the variable to which data is being assigned. You need push here.
As an extra exercise, you should replace "foreach (@_) { if ($_ > $tot_avg) { ... } }" with a call to grep.
You should also look into separating I/O from computation. avg and above_avg shouldn't print anything.
Why are you using "&" in front of subroutine calls? That tells Perl to ignore the subroutine's prototype. Do you have a reason to do that?
In reply to Re: array does not accept more than one number
by ikegami
in thread array does not accept more than one number
by bluethundr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |