in reply to Re: Out of memory
in thread Out of memory

Hi,

Thanks for the reply.

That was precisely my question . I guess there are more efficient ways of reading the file that would alleviate my memory problem - and that's where I need the help. What other ways can I read it in?

Also, u got me scared about the regex /[ +\n+\,\:]/ bit. I thought I was splitting on space/s , newline/s, comma and colon. Am I not ? I'm a Perl novice and any suggestions are much appreciated.

Thanks
J

Replies are listed 'Best First'.
Re: Out of memory
by Abigail-II (Bishop) on Aug 19, 2002 at 12:40 UTC
    Oh, you are reading it in fine - line by line. But then you join all the lines together until you have read all the lines, before you count the words.

    Why not count the words of the line just read, and then read in the next line?

    As for your regex, you split on a space, a plus, a newline, a plus (again), a comma or a semi-colon. I think you want: /[\s,:]+/.

    Abigail