T
Tony Lissner
This is a shortened version.
Anyone have any ideas how to get the
inner loop to increment.
Source file unknown number of lines.
Read the file and print two lines per
page until EOF
This is what I want.
Page N
Headers
Two lines on each page
Page 1
Headers
25,Fred,Nerk
23,Foo,Bar
Page 2
Headers
05,perl,v5.8.8
blank line
This is what I get.
Page 1
Headers
25, Fred, Nerk
25, Fred, Nerk
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
my $page_num = 1;
while (<DATA>) {
my ($num, $fname, $lname) = split ',';
print "\nPage $page_num\nHeaders\n";
foreach (1 .. 2) {
print "$num, $fname, $lname";
}
$page_num++;
}
__DATA__
25,Fred,Nerk
23,Foo,Bar
05,perl,v5.8.8
Anyone have any ideas how to get the
inner loop to increment.
Source file unknown number of lines.
Read the file and print two lines per
page until EOF
This is what I want.
Page N
Headers
Two lines on each page
Page 1
Headers
25,Fred,Nerk
23,Foo,Bar
Page 2
Headers
05,perl,v5.8.8
blank line
This is what I get.
Page 1
Headers
25, Fred, Nerk
25, Fred, Nerk
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
my $page_num = 1;
while (<DATA>) {
my ($num, $fname, $lname) = split ',';
print "\nPage $page_num\nHeaders\n";
foreach (1 .. 2) {
print "$num, $fname, $lname";
}
$page_num++;
}
__DATA__
25,Fred,Nerk
23,Foo,Bar
05,perl,v5.8.8