self being altered even when .dup'ed
I've just narrowed down something that was bugging me, and I think I'm
realizing that its a feature, not a bug or error.
I'm extending chomp to take an array. here's the code:
v = self.dup
v = v.chomp
If you run that with:
a = ["str1\n","str2\n"]
As I'd expect, the newline is gone from v and v, but what bugs me
is that its gone from self as well...its clearly the chomp! call,
but i'm a little confused...i thought .dup would make a copy that i'd
play with leaving the original self alone...it would make sense to me
if i did v = self, but i thought that's where the dupe would solve my
problem...i could code the above slightly differently (using a simple
chomp instead of chomp!) to get around this behavior, but i wanted to
try and understand why its happening...