All you have done is edit a copy of the line in memory, not the file itself. You would need to write the modified output to new file, close it, delete the original and then rename the new file back to the original name.
For a simple mechanism for 'inplace editing' and a piece of example code see perlrun and the description on the -i[ext] switch.
In reply to Re: editing a file with regular expressions
by BrowserUk
in thread editing a file with regular expressions
by gcazian
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |