http://www.perlmonks.org?node_id=250604


in reply to What is the difference between s/ and tr/

I think you might have been originally confused because in certain very specific cases, tr/ and s/ do the same thing. For example, s/a/b/g is the same as tr/a/b/ -- they both replace all instances of a with b. Anything more complex than this and it doesn't work though. You need to think of these as completely separate functions.