From: gabriele renzi Date: 2003-01-05T02:16:08+09:00 Subject: Re: object On Sat, 04 Jan 2003 20:04:20 +0100, Manfred Hansen wrote: >werte = "anfang=123&ende=was" > >werte.split(/&/).each do |x| > key, val = x.split(/=/,2) > puts "key = #{key} , val = #{val}" >end > >puts anfang # => 123 ++ I'm not sure what you asked, but it seems to me that you:: ++ have a string $some_string which holds the values and the var name. after that you get the key and the val, and by the key you'd like to print the value. You even want to change $some_string. I think what you want to do could be possible using a simple hash like werteHash={} and putting each [key, val ] pair in that. This way you could call your puts with puts werteHash[key] You can even add a singleton method to the Hash class to have a method like someHash.key_val_from_string(werte) or simply let it as a method in main . PS what does werte mean? it is ~ "word" ? :)