in reply to Passing Variables

You need to initialize $average_num from the argument list:

my $average_num = shift;