Re: huge file : parsing problem



Saurabh Singhvi wrote:

pardon me for my negligence in calling it the traditional method ;).
I just meant traditional in my history :p.

'for' (or 'foreach') slurps the whole file before processing it, which
is why you were having problems.

Use 'while' for input, and 'for' (or 'foreach') for everything else and
happiness will be yours!

--
http://DavidFilmer.com

.



Relevant Pages

  • Re: Searching in a line
    ... foreach $line { ... use strict; ... missing. ... this version still slurps the entire file. ...
    (comp.lang.perl.misc)
  • Re: Why night races are here to stay...
    ... Did you intend it ... to - or have you just had a few two many slurps of park bench liquor? ... and ignorant not only of the history of Europe but also ... He only whinges when FIAerrari don't win :-))) ...
    (rec.autos.sport.f1)
  • Re: Why night races are here to stay...
    ... Did you intend it ... to - or have you just had a few two many slurps of park bench liquor? ... and ignorant not only of the history of Europe but also ... He only whinges when FIAerrari don't win :-))) ...
    (rec.autos.sport.f1)
  • Re: Frequency in large datasets
    ... Cosmic Cruizer wrote: ... file of 47 gigs. ... foreach { ... This slurps the whole file inot a list and then iterates ...
    (comp.lang.perl.misc)