in reply to Re^4: no reaction on string replace
in thread no reaction on string replace

With the mistake that poj told you about, not only should you have add the content of your file modified, but the new lines should be in your file several times. If it's not the problem you have, try to add a print @lines to check that your file is read correctly. And if it is try to print @newlines to see if its content is what you expect.