in reply to read and write to the same file

Ideally, read in from one file, write out a new file. When done and all happy, copy the new file over the old one.

See Opening files for reading and How do I change, delete, or insert a line in a file to get started.

Cheers, Sören

Créateur des bugs mobiles - let loose once, run everywhere.
(hooked on the Perl Programming language)