Perl isn't seeing the -e switch. Anything immediately following the
-i is assumed to be the backup extension, ie "
perl -i.bak..." will create a backup named filename.bak and operate on the original.
Use perl -i -e '...' (or -i.bak -e if you want a backup).