From: "Matthew K. Williams" Date: 2010-05-05T00:20:42+09:00 Subject: Re: Something I expected to work, but didn't! On Wed, 5 May 2010, Brian Candler wrote: > Matthew K. Williams wrote: >> Now, you could say: >> [x, y].each {|v| v += z} > > Except that does nothing except calculate values and throw them away > (since v drops out of scope at the end of the block). x and y are > unchanged. > > Local variables are not objects, and you can't get "references" to them. > You'd have to do something awful with eval to get the effect you want: > > ["x", "y"].each { |v| eval "#{v} += z" } Good point. I should not reply to mailing lists when I'm distracted by a coding problem in another language. Back to 'bash'ing away.... Matt