in reply to How would I write this multiple substitution script?
The substitution won't work that way, because you opened the file just for reading. So while you change $data the way you want it, you don't write it back into a file in some way.
An easy way to do an in-place substitution is the use of the -i flag on the command line:
perl -i.orig -pwe 's/red/blue/g' /html/*
If you don't want to use a one-liner (or -i on the shebang line), you have to open a second file for writing, write the modified the contents to it, delete the source file and then move the file with the modified contents to the original location.
|
|---|