in reply to How can I replace special characters?

You need to post code, too. In most circumstances, once $ and @ are safely tucked away in a string variable you don't need to worry about escaping them. If, on the other hand, you

  1. use them in a regex,
  2. eval them, or
  3. pass them to the shell through exec, system, or backticks,
you may need to escape them. What you need to escape depends on what is to evaluate them and what your intentions are.

Update: Clarified language introducing the list of exceptions.

After Compline,
Zaxo