in reply to Re: Re: Is it possible to alter a flat file in memory?
in thread Is it possible to alter a flat file in memory?
The magic of the -i doesn't preclude the file from being opened, read, written, and closed does it?It renames the given file then creates an empty file in it's place and writes to that (see. the -i section of perlrun).
I think for all intents and purposes, it meets the OP's needsIndeed. I considered giving a solution where the code did most of the work inplace, but I figured that the OP just wanted ease of use (that's why they're using perl afterall :)
Besides - Tie::File has to read the entire file to index the newlines as well for the array - or am I wrong about that too?It does indeed read the whole file into memory, but as its Dominus' code it's all terrifically optimal :)
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Is it possible to alter a flat file in memory?
by Limbic~Region (Chancellor) on Apr 12, 2006 at 14:50 UTC |