Hi,
In message "[ruby-talk:00405] Ruby regular expression incompatibility/bug"
    on 99/06/29, Julian R Fondren <julian / cartotech.com> writes:

|Ruby:
|% ruby
|foo = '"'
|foo =~ s/"/x/
|print "#{foo}\n"
|--> -:3: undefined local variable or method `s' for #<Object:0x4012ced4>
|---> (NameError)

As answered by Cle, 

  foo =~ s/"/x/

is not a valid Ruby script; it should be 

  foo.sub!(/"/, "x")

to do your intention.  

Notice that no syntax error reported?  Because

  foo =~ s/"/x/
  print "#{foo}\n"

was considered as

  foo =~ s/"/x/\nprint "#{foo}\n"

Intresting?  `#{foo}\n"' was ignored, because it was considered as a
comment, and `s/"/x/\nprint "' was considered was local variable or
argument-less method call `s' devided by the string "/x/\nprint ".

|Ruby using irb (clearer):
|% ruby -r irb -e1
|irb(main):001:0> foo = '"'
|"\""
|irb(main):002:0> foo =~ s/"/x/
|irb(main):003:0"                # what!?

Now you know why irb gave you prompt for string input.

                                                matz.