http://www.perlmonks.org?node_id=890667


in reply to Re^4: incrementing already existing file
in thread incrementing already existing file

There are two sets of values 'A' and 'B'. The code you gave me is considering B set values only. Is there any way I can ask it to look for A first and then move to B.
Almost certainly can. But you need to explain better what 'A' and 'B' are and show some examples of the input files. It sounds as if your data from NEWF have 'A' and 'B' somewhere on each line. 'A' should be replaced by a value from your MYFILE and 'B' should be replaced by a value from SOME_OTHER_FILE. This will be an easy modification if 'A' and 'B' are the last two columns in NEWF. If that is correct, here's how to proceed:

I think you should try to write this code yourself. If I made some wrong assumptions, post back with clarification and (most important) samples of the input files and a sample of what the output should look like. I'm quite happy to help you get your work done, but you will learn best if you give it a go on your own and then ask for help if something doesn't work the way you want.