Assuming the leading whitespace is a typo and you are extracting the line correctly, all you need to do is compute and print the average. There are many ways to do this - here is just one:
#!/usr/bin/env perl use strict; use warnings; use Statistics::Lite 'mean'; my $line = 'Charles 25 24 26'; my ($name, @fields) = split (/ /, $line); my $mean = mean (@fields); printf "%s average is %.2f\n", $name, $mean;
In reply to Re: Retrieve average
by hippo
in thread Retrieve average
by Tigor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |