when writing : string2 = string1 both your variables reference the same address , so , modifications to any of them will cause modification to the other . If you write : string2 = string1.clone then you will modify just string2 , when writing sub! -- Posted via http://www.ruby-forum.com/.