Gsub - variables that are equal are changed


I wanted to keep the original text entry so that I could use it later in the program.
Here is my code.

print "Write your name:"
name1 = gets.chomp
if name1.include? "s"
    name2 = name1
    puts"#{name1} "
    puts "#{name1}, Daffy says your name is #{name2}"
    print name1

Why do "name1 and "name2 get changed using gsub?


Maybe if you read the article
you will understand the consequence of using the exclamation-mark-! operator.


I apologize. Too clarify here is the output that I get.

Write your name: sam
tham, Daffy says your name is tham

I am not using gsub on name1 but in the puts statement name1 has substituted "s" with "th".
I understand that name2 should be modified but why name1?