From: matt@... (matt neuburg) Date: 2009-02-27T06:14:16+09:00 Subject: Re: dynamic variable names or using a variable as another's name Peter Buckley wrote: > bigHash = Hash.new { |h,k| h[k] = [] } > > p4.run_changes("-m5","//depot/path/...").each { > |ch| > string1 = ch["change"] > bigHash[string1] = string1_hash > } > puts(bigHash.inspect) > > This iterates 5 times, each time with string1 being equal to a different > string, so bigHash has 5 keys. The problem I'm having is that the value > of each of the 5 keys is the same - string1_hash. Because you *set* them all to string_hash, in this line: > > bigHash[string1] = string1_hash What were you *trying* to do? Also, don't you have this upside down? I thought we agreed you were going to have *one* key called string1, whose value was an array, and you were going to put 5 different things into that array. I don't see you doing any of that. m. -- matt neuburg, phd = matt@tidbits.com, http://www.tidbits.com/matt/ Leopard - http://www.takecontrolbooks.com/leopard-customizing.html AppleScript - http://www.amazon.com/gp/product/0596102119 Read TidBITS! It's free and smart. http://www.tidbits.com