From the archives: > Re: [Boston.pm] grep w/ 'context' > ------------------------------------------------------------------------ > > * From: Ron Newman > * Subject: Re: [Boston.pm] grep w/ 'context' > * Date: Tue, 30 Apr 2002 15:59:33 -0700 > ------------------------------------------------------------------------ > > > At 7:03 PM -0400 4/30/2002, Kenneth Graves wrote: > > >If you are determined to do it in Perl, then slurp all of the > >lines into an array and print @array[$i-N .. $i+M]. > > If your file is HUGE you may not want to do this. Instead, keep > a rotating buffer array of N+M+1 lines. With each new line, > you discard the least recently read one. > > -- > Ron Newman [EMAIL PROTECTED] > http://www2.thecia.net/users/rnewman/
How do you "discard" an array element in Perl, for the sake of conserving memory? In other words, would someone mind providing the code for the above line-slurping technique? Or by discard do you mean simply reassign over the same set of elements? Thank you, Erik PS: is this list dedicated to news and meeting announcements with occasional help emails, or is it okay to ask help here often?
