yueli711 has asked for the wisdom of the Perl Monks concerning the following question:

Hello, Below is the program to calculate average value. I really do not understand why the value of "count" will change. Thanks in advance!

use strict; use warnings; sub total { my $sum; foreach (@_){ $sum += $_; } $sum; } sub average { if (@_==0){return} my $count=@_; my $sum =total(@_); $sum/$count; }