Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Bit of maths between two files

by NovMonk (Chaplain)
on Aug 05, 2004 at 15:13 UTC ( #380287=note: print w/replies, xml ) Need Help??

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.



Replies are listed 'Best First'.
Re^2: Bit of maths between two files
by Anonymous Monk on Aug 05, 2004 at 15:17 UTC
    sorry should have been clearer, need to add each x element from the 2 file to one another then y and z. Not the sum of each line!

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2023-09-26 22:42 GMT
Find Nodes?
    Voting Booth?

    No recent polls found