in reply to perl -i

The -i switch is usually used for one-liner in-place file edits, combined with the -p switch. So, to substitute 'foo' with 'bar' in a file, from the commandline:

perl -pi -e's/foo/bar/g' filename # or, to leave a backup with a .bak extension: perl -pi.bak -e's/foo/bar/g' filename