You can read all about the Substitution Operator in the
free online documentation at
perlretut. Search for "Search and replace". There are dazzling multi-color code examples complete with hyperlinks!
Or, if you prefer reading from a book, Learning Perl is a good place to start.