in reply to reading text from afile

Try skipping .txt files. If you are processing c:/perl/dvd_files/foo.txt you will open it for reading, and then turn right around and open it for writing (which truncates anything that was there).

If you need to do the substitution on .txt files also, open a different output file and then rename it to where you want it, or read in the entire file before opening it for writing.

Replies are listed 'Best First'.
Re^2: reading text from afile
by fadingjava (Acolyte) on Sep 28, 2004 at 07:57 UTC
    thanks a lot . that was exactly the problem . it was working fine on other extensions but not on txt files .