I think I'd like to see a looser coupling between find_above_average and calculate_average. And I would move the prints outside of the subroutines, to make them more generic.

`use v5.14;
use warnings;
use IO::Interactive qw( is_interactive );
use Scalar::Util qw( looks_like_number );
use List::Util qw( sum );
say "Enter a list of numbers to find above average numbers, one per li
+ne:"
if is_interactive;
my @numbers = get_input();
say "No numbers entered. Exiting" and exit if ! @numbers;
my $average = average( @numbers );
say "The average is $average";
say "The above-average numbers are:";
say "\t$_" for above_average( $average, @numbers );
sub average {
return sum( @_ ) / @_;
}
sub above_average {
my $average = shift;
return grep { $_ > $average } @_;
}
sub get_input {
chomp ( my @numlist = <STDIN> );
return grep { length $_ && looks_like_number($_) } @numlist;
}
`

Update: `s/&&/and/` to fix a precedence issue.

Comment onRe: Any improvement over the code possible??SelectorDownloadCode