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
In reply to Re: Far across cyberspace
by newrisedesigns
in thread Editing a text file without reading it into an array
by whiteperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |