in reply to How to process multiple input files?
Try using the while construct with the <> operator. Something like
while (my $line = <>) { ... }
Oops, after submission I saw jwkrahn responded in more detail. That comment should solve (both) your problems, which I now understand to be 1) looping over command line file names, and 2) Modifying the second line of each file. One thing you might do instead of maintaining your own counter would be to use the built-in line counter. The special $. line number variable will be properly maintained from file to file. (will not be properly maintained with the <> operator unless you take special steps as described in the link given. Thank you again jwkrahn.)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to process multiple input files?
by John M. Dlugosz (Monsignor) on May 23, 2011 at 00:27 UTC | |
by jwkrahn (Abbot) on May 23, 2011 at 06:51 UTC | |
by jaredor (Priest) on May 23, 2011 at 12:28 UTC | |
by jaredor (Priest) on May 23, 2011 at 05:08 UTC |
In Section
Seekers of Perl Wisdom