On Wed, 2004-09-08 at 18:01, Eduardo V�zquez Rodr�guez wrote:
> Hello
> 
> I am writing scripts that  process big files which contains too many 
> lines (aproximately 700 000 lines per file). My strategy until now to 
> solve this problem is reading line per line, something like this
> 
> while (<FILE>)
> {
>     dosomethingwith($_);
> }
> 
> Is there any way of working with multiple lines at the same time? can 
> anyone suggest any better strategy?

From a discussion on the Fun-With-Perl mailing list:

while (my @a = map { eof() ? () : scalar <> } 1 .. $n) {
        dosomethingwith(@a); # @a contains $n lines
}

HTH,

jac

> -- 
> Eduardo V�zquez Rodr�guez <[EMAIL PROTECTED]>
> Consultor�a Implantaci�n
> Tel. 5322 5200
-- 
Jos� Alves de Castro <[EMAIL PROTECTED]>
  http://natura.di.uminho.pt/~jac

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to