in reply to Re^4: How to loop over two lines, alter a value in the current line and save it to the previous line?
in thread How to loop over two lines, alter a value in the current line and save it to the previous line?

How does this not accomplish that?
$previous_line = $current_line = join ' ', @current_cols;
The way forward always starts with a minimal test.
  • Comment on Re^5: How to loop over two lines, alter a value in the current line and save it to the previous line?
  • Download Code

Replies are listed 'Best First'.
Re^6: How to loop over two lines, alter a value in the current line and save it to the previous line?
by rjc33 (Sexton) on Jan 07, 2016 at 14:14 UTC
    I've no idea why, but as with the first answer in this thread it seems to make $previous_line always be the first line in the file.
      Correction: I just hadn't implemented it properly, that works! Thanks so much! The issue was there was some circularity in my earlier code, part of the calculations I was doing were actually working on the old values (even though I wanted it to use new values on the whole), so once I took those out I could see that what you'd suggested works. Thanks again