opening a file in perl
Michael Still
mikal at stillhq.com
Wed May 1 10:06:21 EST 2002
On Wed, 1 May 2002, Nemo - earth native wrote:
I'm no guru, but here I go...
> ...except when the file being opened is the better part of 400meg,
> and so I get Out of Memory errors - the perl seems to wants to read the
> whole file into memory before looking at it at all.
I've done this with multiple GB files and had no problems...
> At the moment is opens the file as such:
> open( IN, "chunk.txt" ) or die "Hrm. Couldn't open the file./n";
Try doing an:
open IN, "< chunk.txt";
Perhaps the semantics are different?
> And then just runs through line by line:
> foreach my $line ( <IN> )
> {
> (insert a few possible regexp matches in `if` statements here. simple stuff)
> }
Nothing scary here. What are you doing with the regexps? Your not storing
information in RAM as you do through the file?
Mikal
--
Michael Still (mikal at stillhq.com) UMT+10hrs
More information about the linux
mailing list