in reply to Re: Re: replacing in file
in thread replacing in file

It's not working because you lost the -i switch, which specifies edit-in-place. Do "perl --help" to get a list of command line switches. You really shouldn't invoke an external process, though, if you don't have to do so. Just follow the other idiom I mentioned. To elaborate...

open(OLD, "<old.txt") or die "can't open original file: $!"; open(NEW, ">new.txt") or die "can't open new file: $!"; while(<OLD>) { s/whatever/somethingelse/; print NEW; } close(OLD); close(NEW) rename("new.txt", "old.txt");