From: Michael Satterwhite Date: 2009-03-06T06:26:17+09:00 Subject: Referencing Variables By Name in a String I can think of several (rather ugly) ways to accomplish this, but thought I'd check here to see if there is a simpler way to do this. I'm constantly amazed by the features in Ruby (I admit to only knowing a relatively small subset of them) Assume I have objects (created in autogenerated code that frequently gets regenerated. I can't change this part of the code directly (QTRuby), so creating them in an array isn't really an option. The names of the variables are pauseBox1, pauseBox2, pauseBox3 .. pauseBox8. There are several variable groups like this - this is only one of them. I periodically have to apply a block of code to each of them in sequence. They're not in an array, so I can't directly enumerate over them. It would be kinda nice to be able to do something like: 1.upto(8) do |i| box = "pauseBox#{i}" end Does anyone know a way to accomplish something like this. If not, I probably have to put code in the derived class to create the arrays, but this is going to look messy to say the least ... there are a lot of these items. Thanks in advance ---Michael -- Posted via http://www.ruby-forum.com/.