http://www.perlmonks.org?node_id=999018


in reply to One-liner to fix LaTeX quotation marks

If you want to override existing file you can use -i option: perl -i -pe 'your script' file.txt