P is for Practical | |
PerlMonks |
Re: Selecting successive linesby kcott (Archbishop) |
on Sep 17, 2013 at 04:05 UTC ( [id://1054382]=note: print w/replies, xml ) | Need Help?? |
G'day zee3b, You can read that data in paragraph mode (see perlvar for details): basically, this allows you to read each group of three lines as a single record. When you do this, you can grab the name, from line 1, and the score, from the end of line 3, in a single operaton.
Output:
For your real application, you'll probably also want either int for whole number averages, or sprintf to format floating point results. -- Ken
In Section
Seekers of Perl Wisdom
|
|