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
In reply to Re: Re: Re: Is it possible to alter a flat file in memory?
by broquaint
in thread Is it possible to alter a flat file in memory?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |