Eduardo:

Depending on how many lines you need to work with at once and how disparate they are, 
you could create a buffer of the last N lines to work on, such as:

while ( <FILE> ) {
      push @buffer, $_;
      shift @buffer if @buffer > 10; # @buffer will now have the current
                                     # and last 10 lines
}

I'm not sure if this is what you want, but hopefully it helps.

Regards,

Matt

----
http://www.thinktechnology.ca/

> -----Original Message-----
> From: Eduardo Vázquez Rodríguez [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 08, 2004 2:02 PM
> To: Perl Beginners
> Subject: Reading Multiple Lines
> 
> 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?
> 
> 
> --
> Eduardo Vázquez Rodríguez <[EMAIL PROTECTED]>
> Consultoría Implantación
> Tel. 5322 5200
> 
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to