in reply to Re: Re: Changing data in alot of files
in thread Changing data in alot of files

Most efficient? Not a chance. Doing linear scans of the data like that isn't going to win you any points in the efficiency department. However, it is vastly easier to code then trying to do in-place editing of the file (assuming you need to do this as part of a larger program, so that dragonchild's response wouldn't help you much).

If the data is small, you could slurp the file into a single scalar and then run your s///g's. You may or may not see any performance benifit doing it this way, depending on your hard drive cache, IO buffering, OS implementation, phase of the moon, etc.

Still, Tie::File probably satisifies both efficency and ease of development. I've never used the module myself, but I don't know of any reason why it shouldn't work on NT.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated