use 5.012; use List::Util qw(reduce); my @grades = ; say((reduce { $a + $b } 0, @grades) / @grades);