in reply to Files not altered

You aren't modifying files.
<> reads from STDIN print; writes to STDOUT
You need to either explicitly open an output filehandle and print to it in the foreach loop or use the "-i" magic mentioned above.