There are a number of different ways of doing this.
The biggest problem to overcome is that normally, you can
not have a file open for both reading and writing. You have
to read the file in, make modifications, write to a new file, and
then copy back over the original. There is a better way!!!
I would recommend you use Tie::File (or learn $^I)
Go to
Tie::File
for (@array) {
s/PERL/Perl/g;# Replace PERL with Perl everywhere in the file
}
Changes you make to the array are reflected in the file immediately!