From: stephen O'D Date: 2008-07-02T00:37:18+09:00 Subject: Re: Dynamic Variables On Jul 1, 1:50 pm, Gregory Seidman wrote: > On Tue, Jul 01, 2008 at 06:45:48PM +0900, Marc Heiler wrote: > > Is there any way in ruby to create dynamic variables? > > > counter = 52 > > box#{counter} = "cat and dogs" > > > There would be then a new variable > > box52 > > > Note that this is not a question whether someone should do it or not - > > this is solely whether it is doable or not. Until today I thought it is > > somehow possible with eval but I failed, so I assume it is not possible. > > I'm going to give you exactly what you didn't ask for: why this is a bad > idea. This is a discussion about Perl rather than Ruby, but it remains > relevant:http://perl.plover.com/varvarname.html > > See the subsequent parts of the series for further discussion. > > --Greg Here here - I remember reading that article way back - the basic point of it is that if you want to create a variable on the fly, it probably means you should be using a Hash.