Question: Using Perl: Write a subroutine, called above_average , which takes a list of numbers and returns the ones which are above the average (mean). (Hint:
Using Perl:
Write a subroutine, called above_average, which takes a list of numbers and returns the ones which are above the average (mean). (Hint: make another subroutine that calculates the average by dividing the total by the number of items.) Try your subroutine in this test program.
my @fred = above_average(1..10);
print "\@fred is @fred ";
print "(Should be 6 7 8 9 10) ";
my @barney = above_average(100, 1..10);
print "\@barney is @barney ";
print "(Should be just 100) ";
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
