in reply to How to get previous line of the file while processing current line in while loop

Your question is "how do I implement a single element buffer"? It's easy:
my $previous = <STDLOG>; while (my $current = <STDLOG>) { print "Current line is: $current"; print "Previous line is $previous"; $previous = $current; }
  • Comment on Re: How to get previous line of the file while processing current line in while loop
  • Download Code