Try this:
#!/usr/bin/perl use strict; use warnings; $^I = '~'; while (<>) { s/\s+myOldPass/ Onl33In05h15notmyreallpass/g; s/\s+myDBUser/ my-secret-db-user/g; print; }
See perldoc perlvar for description of the $^I variable. Alternatively you can use -i switch for perl.
Update: note also that you don't need foreach to loop through @ARGV. <> will loop automatically.
Update2: fixed extension
In reply to Re: Files not altered
by zwon
in thread Files not altered
by bluethundr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |