in reply to
replacing while keeping the position of the element in the file
I don't see what purpose the second file has. It looks like you just want to remove the newlines from the first file.
Comment on
Re: replacing while keeping the position of the element in the file
In Section
Seekers of Perl Wisdom