Just looping thru a file, will not edit it's data on the harddrive. You need to open the file, write your changes, the save it. What you are doing is working on a temp copy of the file. See
Compact multi-line inplace file edit search and replace or google for "perl in place edit" for many other recipes. As a caveat, and what you are trying, there is a shortcut available by working on files in @ARGV, but in general, you open, write and save. The @ARGV stuff is sort of Perl magic, and not the general method for modifying files.