in reply to Cleaner way of looping through a file and stripping only certain lines?
Open the file. Read the file into an array. Close the file. Open the same file for overwrite and write what you want back.
UPDATE: Fixed some C&P errsopen(IN, '<', $ifile) or die "Couldn't open file: $!\n"; my @data = <IN>; close IN; open(OUT, '>', $ifile) or die "Couldn't open outfile: $!\n"; foreach my $line (@data) { ### Do what you want print OUT "$line"; }
| XP matters not. Look at me. Judge me by my XP, do you? |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Cleaner way of looping through a file and stripping only certain lines?
by throop (Chaplain) on Dec 08, 2006 at 17:14 UTC | |
by grep (Monsignor) on Dec 08, 2006 at 17:34 UTC | |
by jbert (Priest) on Dec 08, 2006 at 18:22 UTC |