Hi, Daniel Carrera wrote: > 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: Yes and I have start to write a mod_ruby handler. Here i am possible to read the values from the "POST" and "GET" methods. The values are in on string for example werte = "anfang=123&ende=was" At the moment i am possible to get the values over a hash in the eruby scripts. For example: puts "anfang = #{$hsh['anfang']}" I will be nice to do that without complicated hash in eruby scripts. The same in php scripts. Ok i will try this with eval. Cheers, Manfred > > 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 >> >> >>