sub transform { my $coderef=shift; reduce($coderef,@_)/(@_+1); } sub display { printf("Avg: %f",transform(sub { $a > $b ? $a : $b },@_)); }