metaperl has asked for the wisdom of the Perl Monks concerning the following question:
I have written this program and it works, but I'm sure that it could be written much more compactly:
use strict; use warnings; my $line_count = -1; my $accum; while (<STDIN>) { # ignore first line of file. It is a header line # nonetheless, increment line count if ($line_count == -1) { print; ++$line_count; next; } s!\n!!g; if ($line_count % 2) { print "$accum$_\n"; $accum = ''; } else { $accum = $_; } ++$line_count; }
| I have beheld the tarball of 22.1 on ftp.gnu.org with my own eyes. How can you say that there is no God in the Church of Emacs? -- David Kastrup |
|
|
|---|