Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by 1nickt (Canon)
on Jan 07, 2016 at 14:07 UTC ( [id://1152187]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1152187]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-25 19:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found