in reply to Write contents of a file, whilst reading from another file
You can read and write as many files as you want at the same time (within the limits of your OS restrictions of course).
open(FILE1, "<input_file"); open(FILE2, ">output_file"); while(<FILE1>) { do_stuff(); print FILE2; } close(FILE2); close(FILE1);
In general if you can do it this way, it is better than reading the whole thing into memory (which will of course take a lot of memory for large files).
| We're not surrounded, we're in a target-rich environment! |
|---|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Write contents of a file, whilst reading from another file
by hardburn (Abbot) on Apr 01, 2003 at 16:12 UTC | |
by Limbic~Region (Chancellor) on Apr 01, 2003 at 23:25 UTC |