cat some_file_holding3numbers.txt | avg_routines.pl (+some way of specifying avg3())> avg.txt
####
perl -w avg_routines.pl (+some way of specifying avg3()) avg.txt
####
my $Routine = shift; # Get routine name from cmd line
&{ $Routine }; # Call named routine