$perl -p -i -e 's/goonies/gremlins/g' monsters.txt

The -p indicates that the substitution be done for every line in monsters.txt.

The -i causes changes to be written in place.

The -e indicates that the stuff in between '' is the program to execute.