in reply to Formating Text Files
if you have multiple header lines inside the file, you will need to check in the loop to make sure that you skip the header lines.# skip the header line, assuming it's the first line # otherwise, you'll have to check in the loop to see # if you have grabbed a number or a string my $header = <FILE>; my $total = 0; my $count = 0; while(<FILE>) { $total += (split('"', $_))[3]; $count++; } print "Average: ",$total/$count, "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Formating Text Files
by Anonymous Monk on Jun 20, 2002 at 16:19 UTC |