in reply to [Homework Question] Subroutines & References
#!/usr/bin/perl use strict; use warnings; use List::Util qw(sum); my @list_of_numbers = ( 1 .. 50 ); my $i = (); my $a = (); sub mean { return sum(@_) / @_; } sub above_mean { $i == mean(@list_of_numbers); foreach (@list_of_numbers) { if ( $a > $i ) { print "$a is above mean, which is mean(@list_of_numbers)"; } print above_mean(@list_of_numbers);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: [Homework Question] Subroutines & References
by Hayest (Acolyte) on Feb 11, 2015 at 16:30 UTC | |
by SuicideJunkie (Vicar) on Feb 11, 2015 at 18:12 UTC |