Craig Cardimon wrote: > > I was reading files first into an array and then into a > scalar variable > for different kinds of processing. > > This worked well until the files began growing in size. The > largest I've > encountered so far is about 45 MB. When I try reading such a > file into > memory, well, things get ugly fast.
I can imagine it would. > > I tried using Tie::File, but that module changes the source files. I > need them to remain pristine. Presumably because you told it to, no? Perhaps you should tell it to open the file read only. It tells you how in the docs. > > I was reading the entire file into memory because my code > contains lines > such as the following: > > while($wholefile =~ /(drilling|mineral|land) rights/gi) > > This construct is really efficient for counting occurrences globally. > > Looks like I will have to rewrite the script to process files line by > line, unless I stumble upon a miracle module on CPAN. It is usually a good idea to process files piece at a time (it doesn't have to be lines!). I don't know how hard it would be to redesign your script as I have no idea what it is you are trying to do. BTW, if you find something in CPAN that helps, please let us know. > > If anyone knows of an efficient way to process large files > line by line, > other than the standard "|while( <FH> )|", please let me know. It has always been efficient enough when processing large files for me. So far, that is. HTH -- Brian Raven ----------------------------------------------------------------------- The information contained in this e-mail is confidential and solely for the intended addressee(s). Unauthorised reproduction, disclosure, modification, and/or distribution of this email may be unlawful. If you have received this email in error, please notify the sender immediately and delete it from your system. The views expressed in this message do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary companies. ----------------------------------------------------------------------- _______________________________________________ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
