huh, I almost thought it is impossible to make `-s` work when perl is called with `-i`, `-p` and `-e` but it can! The only way it could work is like:
perl -p -i -s -e 's/haha/$i/ge' -- -i=gaga "${FILES[@]}"
Thanks for all suggestions that made me find out this.