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


in reply to Bit of maths between two files

What do you want when you get done? A file with the sum of each line from both files, printed 1 to a line? If so, why do the original files need to be combined into one at all? Why not do something like this:

open first file for input
open output file for write
split the line
add up the line elements
print the result to output file
open second file and follow the same steps above, continuing to write to the same output file you still have open

While I could probably use the homework practice myself, I'm deliberately not doing the code for you-- looks like you can handle that. Just suggesting a different way to think about your problem. Or demonstrating I don't understand it.

Good Luck.

Pax,

NovMonk