From: Hal Fulton Date: 2004-06-14T05:13:01+09:00 Subject: Re: Use a string a object name Marek Janukowicz wrote: > On Sun, 13 Jun 2004 21:31:27 +0200, Dirk Einecke wrote: > >>I've a little problem. How can I use a string use as an object name? >> >>That works well: >>puts p.name # -> dirk >> >>But how can I use the string s as object name, I tried eval but I the >>result is not good. Where is my mistake. Can anybody help me? >> >>s = 'name' >>puts eval "p.s" > > > puts eval "p.#{s}" > The 'send' method (as Mark said) is the better way to do this. Hal