I think it is explained in one of my FAQs. Basically, you open it for read, open a new file for write, readline, count lines, string compare, replace, writeline, close.

...or use Howard's QReplace.
http://mywebpages.comcast.net/habullock/Perlutilities.htm
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.