From: Daniel Carrera Date: 2003-01-05T03:12:23+09:00 Subject: Re: object I suppose that Philips CGI solution is what you are really after. However, if you still want to create variables as in your example, here is how: Use the 'eval' function. A first thought is to type: eval "#{key} = #{val}" But this has the problem of scope. This is read as: eval "anfang = '123'" 'anfang' is local to the eval, and it disappears when the eval is done. The best you can do is to make it a global variable: eval "$#{key} = #{val}" Now $anfang exists after the eval is done, and it has the value '123'. I hope you realize that, as it is, '123' is a string, not an integer. Perhaps what you want is: eval "$#{key} #{val.to_i}" Cheers, Daniel. > Hi, > > i have the following script: > > werte = "anfang=123&ende=was" > > werte.split(/&/).each do |x| > key, val = x.split(/=/,2) > puts "key = #{key} , val = #{val}" > end > > puts anfang # => 123 > > The goal is when i make puts anfang to get the value "123". > The problem is the values from werte can be changed > for example: > werte = "irgendwas=hu&ruby=super" > > Now i will make puts irgendwas => hu > And so on. > > Is this possible? > > > Manfred > > >