Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Dealing with nextline of a fileby fishy (Friar) |
on Jul 31, 2021 at 20:36 UTC ( [id://11135546]=note: print w/replies, xml ) | Need Help?? |
Hi jnarayan81,
you can adapt the following code, seen on the web as "Rolling buffer" (by Toby Inkster or Ingy döt Net, can't remember): For $n=2, on each iteration, $cache[0] and $cache[1] will contain a pair of adjacent lines.
In Section
Seekers of Perl Wisdom
|
|