in reply to Re^2: reading from middle of file
in thread reading from middle of file
Question 1:
First, if I'm printing a string and the value of a calculation of 2 variables, as in:
print "The average is $total/$count";
...how can I do it so that the value of the calculation shows up?? Right now I'm getting something like:
The average is 60/9
Just take the calculation out of the quoted string.
print "The average is ", $total/$count;Do I have to use PRINTF??? In fact, while we're on this subject, how can I format the value so that it only has two decimal places?
That you can do with printf.
printf "The average is %.2f", $total/$count;Question 2:
What are these NEXT, UNLESS and LAST statements? In my whooping 1 week of PERL, I haven't yet come across these statements. I'd like to learn. Can you suggest a good place for looking up PERL syntax/statements?
Type perldoc perltoc at your command line to see the table of contents for the Perl documentation. For the loop control statements, see the "Loop control" section in perldoc perlsyn.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|