T
tux.tango
I have a text file that is somewhat structured. I can get the "first"
line from the file but not the others. I am not sure how to read all
the lines at the same time. If I check ($count % 8) == 2, I can get
the second lines, but I coundn't figuire out how to check it in the
same while loop.
#!/usr/bin/perl
use strict;
my $count = 0 ;
while(<DATA>) {
$count++ ;
if ( $count % 8 == 1) {
print "Title: $count $_ \n"; }
}
__END__
This is a title
This is a place
This is time
This is Age
This is Desciption
====
This is Title2
This is Place2
This is Time2
This is Age2
This is Description2
====
line from the file but not the others. I am not sure how to read all
the lines at the same time. If I check ($count % 8) == 2, I can get
the second lines, but I coundn't figuire out how to check it in the
same while loop.
#!/usr/bin/perl
use strict;
my $count = 0 ;
while(<DATA>) {
$count++ ;
if ( $count % 8 == 1) {
print "Title: $count $_ \n"; }
}
__END__
This is a title
This is a place
This is time
This is Age
This is Desciption
====
This is Title2
This is Place2
This is Time2
This is Age2
This is Description2
====