Bryan Harris wrote: > If I'm reading in many-megabyte files, is it considered to be more > efficient to read it into an array, then loop over the array? Or is > reading a line at a time okay? > Depends really on the size and what you trying to do. Almost all that I do, I read a line at time, but others will swallow in the file. Most of my regex's deal with single lines or a single line will start another set of sequences.
Wags ;) > e.g. > > ************************************** > while (<>) { > # do some process with each line > } > ************************************** > > or... > > ************************************** > @lines = <>; > foreach (@lines) { > # do some process with each line > } > ************************************** > > I realize the second will use more memory, but what's a few megabytes > in today's computers? I'm more worried about the OS having to go > back to the disk a couple hundred-thousand times -- seems like it'd > be hard on the disk. > > TIA. > > - Bryan ********************************************************************** This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. ********************************************************************** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>