From: Robert Klemme Date: 2010-09-23T15:27:55+09:00 Subject: Re: Odd behavior when << hash On 22.09.2010 21:51, Alex Stahl wrote: > Thanks, Rob. Made the mistake of assuming I get a copy of the hash when > I push it. IIRC, there are other (not-so-elegant) languages that do so. > > Appreciate the point about .dup as well, but since at the end of this, > I'm just writing everything out to a file, and the elements of ids will > never change (at least not in this script), I don't think I need a > duplicate string. To complement the excellent explanations you have been given already: the technical term for the effect is "aliasing". http://en.wikipedia.org/wiki/Aliasing_(computing)#Aliased_pointers Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/