From: "Olivier D." Date: 2004-07-04T18:37:43+09:00 Subject: Re: Problem with "eval" On 2004-07-04, Dirk Einecke wrote: > I've a id and a value. Now I want a variable with id as name and the > content from value as value of this variable. I tryed like this: > > id = 'foo' > value = 'This is the value.' > eval "$#{id} + ' = ' + #{value}" # -> $id = 'This is the value.' First, your eval string should be: eval "#{id} = '#{value}'" id and value are replaced to form the expression: eval "foo = 'this is the value'" which is OK with irb. But it doesn't work with ruby, and it's explained here: http://tinyurl.com/2vc4u . One solution would be to use a hash to store id, value as key, value... -- Olivier D.