From: Michael Campbell Date: 2002-07-19T00:29:13+09:00 Subject: Re: How to name a variable after another variable's value? --- Kurt Euler wrote: > All- > > Is there a way to name a variable partly after the value of some > other variable: > > I tried to do something like this: > > greeting_no = "2" > sp#{greeting_no}_greeting = 'Hello' > > ...with the idea of making 2nd line equivalent to writing: > > sp2_greeting = "Hello" > > ...but this didn't work. There's always eval, but... I have to ask; why do [you think] you need this? I ask my question only semi rhetorically, because whenever I thought I needed something like that, I typically found that I was thinking about the problem wrong. In other words, a design smell that led to a code smell. You might also consider an array, and index by "greeting_no". ===== -- Use your computer to help find a cure for cancer: http://members.ud.com/projects/cancer/ Yahoo IM: michael_s_campbell __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com