From: "Chas. Owens" <[EMAIL PROTECTED]> > On 10/3/07, Jonathan Lang <[EMAIL PROTECTED]> wrote: > snip > > Chas shows one possibility. However, that approach generally involves > > slurping the entire file into the perl script, applying the regex to > > the whole thing, and then spitting the result out again. From what I > > understand, this generally isn't very good form. > snip > > The reason slurping files is frowned upon is that you do not know how > large the file may be. You may be testing with small files, but > production may be using multi-gig files. Source files are almost > always less than a few megabytes (and if they aren't you have a bigger > problem than a slurp).
If I found a source file that would be even just one megabyte, I'd first make sure it's really a source file and not a generated intermediate file and if it's not I'd go and start shouting at the person that created the file. (Yes, I do have a "source" file that's 1.08MB. It's generated.) In this case I'd check that the size is reasonable and slurp. It'll make the code much simpler. Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/