Hi,

In message "[ruby-talk:14203] gsub and literal strings"
    on 01/04/25, Joel VanderWerf <skeeler / sirius.com> writes:

|Question: why doesn't gsub distinguish between a string and a regexp in its 
|first argument, whereas []= does?

How about

  "foo $x baz".gsub(Regexp::quote('$x'), 'bar')