in reply to How to Print Every Other Line
After you've opened *IN from the input file and *OUT to the output, use the $. variable to tell you how many lines have been read.
which will print odd-numbered lines to OUT. Replace if with unless to print even lines.while (<IN>) { print OUT $_ if 1 & $. ; }
Update: Corrected typo.
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to Print Every Other Line
by tbone1 (Monsignor) on Jun 30, 2004 at 20:05 UTC | |
by Jasper (Chaplain) on Jul 01, 2004 at 08:35 UTC |