http://www.perlmonks.org?node_id=931177


in reply to How would I write this multiple substitution script?

Why don't you test it on a test directories with test files?

Yes, you headed in a right direction. In the first directory you rename files and in the second you substitute contents of a files.

well, hint.

foreach $filename (@files) { open FILEIN, "<", $filename; open FILEOUT, ">", $filename."new"; while (my $data = <FILEIN>) { $data =~ s/red/blue/g; print FILEOUT $data; } close FILEIN; close FILEOUT; }
...and then rename.