Possible Duplicate:
How to replace a string in an existing file in Perl?
I need to create a subroutine that does a search and replace in file.
Here’s the contents of myfiletemplate.txt:
CATEGORY1=youknow_<PREF>
CATEGORY2=your/<PREF>/goes/here/
Here’s my replacement string: ABCD
I need to replace all instances of <PREF> to ABCD
Quick and dirty:
Perhaps it i a good idea not to write the result back to your original file; instead write it to a copy and check the result first.