Can you be specific as to how it doesn't work?
- what does your input file contain?
- what is your pattern?
- what is your replace string?
- what OS are you on?
- what output do you get (or error messages)?
- what output do you expect to get?
- what is the meaning of life?
S///g should be lowercase:
s///g
use warnings; is good too.
If your pattern has special characters, you may need to escape them (quotemeta).