in reply to Re: Re: Calculating the average of a column in a flat-file database
in thread Calculating the average of a column in a flat-file database
But my main goal is to display the average of that calculation
Well, that's not hard :) - actually more than trivial, you output values by printing them. So after Masem's code put either one of those
# with string interpolation print "The average is $average.\n"; # or with string concat print "The average is " . $average . ".\n"; # or with multiple arguments to print print "The average is ", $average, ".\n"; # or using printf and rounding to 2 decimals printf "The average is %.2f.\n", $average;
I suggest you try to get a good book on perl, e.g. Learning Perl (3rd edition) by our one and only merlyn. Also have a look onto our New Monks Info Page. There you will find lot's of sources of information on perl and tips to get started.
-- Hofmator
|
|---|