Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Merging text file

by nemesdani (Friar)
on Sep 05, 2012 at 22:09 UTC ( #991956=note: print w/ replies, xml ) Need Help??


in reply to Merging text file

A newline is a \n, not a \b.
If your files are text files, why are you using a binmode read?
You are opening the same file twice.
About your core problem: if your files have the same number of lines, you could simply use a while loop for example. while (defined $line1 = <FILE1>)
Then you read a line from the second file the same way, join them, or concatenate them, then write out the resulting $joinedline to a third file. (Which you already opened for writing.)


I'm too lazy to be proud of being impatient.


Comment on Re: Merging text file
Select or Download Code
Replies are listed 'Best First'.
Re^2: Merging text file
by gon770 (Novice) on Sep 06, 2012 at 13:21 UTC
    Sorry for my mistake in the code. Thank you so much for the answer :) Have a good day

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2015-07-28 04:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (252 votes), past polls