Xiong Chiamiov wrote:
> I have a list of variables that I need to pass through a modifying
> function.  Rather than specify for each one, I have them in an array,
> and I loop through the array:
> 
> wml_needed = [@question, @answer_explanation]
> wml_needed.each {|chunk| chunk = wml(chunk)}
> 
> The problem is that, unlike practically everything else in Ruby, each
> loops don't pass by reference, so my assignments get lost.
> 
> Just to make sure, calling the function directly *does* work as
> expected:
> 
> @question = wml(@question)
> 
> In PHP, I can add an ampersand (&) to the name (chunk, in this example)
> to pass by reference instead of by copy; is there something similar in
> Ruby, or should I be approaching this with a different method?
> 
> I realize that there are only two items in this example, but I'm
> building for having many more.

Check out Array#map!

-- 
RMagick: http://rmagick.rubyforge.org/