in reply to Basic arithmetic functions

Check out split, it can be real helpful at times.

# real important! use strict; use warnings; # this is the file where the data is my $file = 'path_to_file'; # these are some useful variables my $sum = 0; my $lines = 0; my $avgerage; # open file open(FH, $file) or die "File $file failed to open:"; #read file in line by line while(<FH>) { # get the third column and add it to $sum $sum += (split /\s+/, $_)[2]; # update $lines $lines++; } # now, to get the average, all you do is say $average = $sum/$lines;