Your code isn't modifying the file because it's not writing to it; the substitution only affects the string in memory. That it has been read from a file is irrelevant at that time.
The easiest way to accomplish what you want is to use perl's -i switch; see perlrun for more.
In reply to Re: Modifying a file using RegEx
by AppleFritter
in thread Modifying a file using RegEx
by gotsilk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |