in reply to Editing a text file without reading it into an array
You could (but of course, TMTOWTDI):
open ($in, $infile) or die("Cannot open $infile"); open ($out, '>', $outfile) or die("Cannot open $outfile"); flock($out, 2); #lock output file while(<$in>){ ### edit each line here using $_ print $out $_; ## print each line to output } close($out); close($in);
As for monks to study, I suggest for starters looking at the posts of merlyn, tilly, jcwren, erudil, and crazyinsomniac (in no particular order).
Every monk here has something from which you can learn, and I'm sure you will have many ideas to contribute.
Update: followed Aristotle's suggestion and replaced foreach with while.
I should have known this, because "while(<$fh>)" was an answer to a question I previously asked. Sorry for the confusion, I'm just foreach happy. :)
John J Reiser
newrisedesigns.com
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Editing a text file without reading it into an array
by cjf (Parson) on Jun 30, 2002 at 05:59 UTC | |
by whiteperl (Scribe) on Jul 05, 2002 at 09:00 UTC | |
|
Re^2: Far across cyberspace
by Aristotle (Chancellor) on Jun 30, 2002 at 10:59 UTC |