in reply to How to get previous line of the file while processing current line in while loop
my $previous = <STDLOG>; while (my $current = <STDLOG>) { print "Current line is: $current"; print "Previous line is $previous"; $previous = $current; } [download]