You're talking about in-place editing, for which Perl has a special idiom: the -i command line switch (for one-liners) or the $^I special variable for larger programs. This is a lot easier and safer than using read-write mode for text files. Since you didn't provide all the config information you are using, and you weren't too clear on all you want to happen to the subject file, I'm offering this simplified code to get you on the right track:
$^I = '~';
push @ARGV, 'Test.txt';
while (<>) {
s/^(PERFORM)/* $1/;
print;
}
See for details:
open and look for the -i switch in
Command-Switches
If what you want to do is a lot more complex, you may want to handle the files yourself rather than with $^I, however you will still be better off opening input and output separately I think. Text is not easy to handle in rw mode.