Based on the data you have shown. I wrote the code below. However, please be warned that I wrote this off the top of my head and it may not work or even do what I purport it to do.
use strict;
use warnings;
my @array;
my @values;
my $avg;
while(my $line = <DATA>) {
push @array, $line;
}
foreach my $line2 (@array) {
my ($time, $val, $err) = split / /, $line2;
push @values, $val;
my $tot_val += $val;
$avg = $tot_val / $#array;
}
my @sort_max = sort {$a <=> $b} @values;
my @sort_min = soft {$b <=> $a} @values;
my $max_val = pop @sort_max;
my $min_val = pop @sort_min;
foreach my $line3 (@array) {
my ($time, $val, $err) = split / /, $line3;
if($val == $max_val) {
print "max: $line3" . "\n";
} elsif($val == $min_val) {
print "min: $line3" . "\n";
}
}
print "avg: $avg" . "\m";
__DATA__
04/26/04.16:15 3.088 N
04/26/04.16:15 5.994 N
04/26/04.16:15 4.391 N
04/26/04.16:15 3.616 N
04/26/04.16:20 3.997 N
04/26/04.16:20 4.151 N
04/26/04.16:20 3.751 N
04/26/04.16:20 2.887 N
04/26/04.16:25 3.657 N
04/26/04.16:25 4.712 N
04/26/04.16:25 4.346 N
04/26/04.16:30 3.628 N
04/26/04.16:30 5.636 N
04/26/04.16:30 4.593 N