Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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.

Pax,

NovMonk

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2022-05-29 12:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (101 votes). Check out past polls.

    Notices?