Which gives:use strict; <DATA>; # Throw away the header while (<DATA>) { chomp if not $.%2; print; } __DATA__ Line 1: Header Line 2: Keep me! Line 3: Join me to the previous line. Line 4: Keep me! Line 5: Join me to the previous line. Line 6: Keep me! Line 7: Join me to the previous line. Line 8: Keep me! Line 9: Join me to the previous line.
Line 2: Keep me!Line 3: Join me to the previous line. Line 4: Keep me!Line 5: Join me to the previous line. Line 6: Keep me!Line 7: Join me to the previous line. Line 8: Keep me!Line 9: Join me to the previous line.
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
In reply to Re: When every 2 lines of a file (sans first) should be 1...
by CountZero
in thread When every 2 lines of a file (sans first) should be 1...
by metaperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |