From: Phrogz Date: 2007-06-14T07:25:03+09:00 Subject: Re: question: referencing a variable with a variable On Jun 13, 3:26 pm, knohr wrote: > I come from a perl background. I have gotten in the habit of using > references to variables instead of specifically calling said variable/ > class/whatever. In Ruby, a variable is a reference to an object. While you can create multiple references to the same object, you cannot create a reference to a variable. You can create an object that refers to another object: foo = { :obj => [1,2,3] } # Hash with a key that points to an array bar = { :obj => foo } # pointing to the other hash ...but you can still swap out what the variable foo points to and the :obj key in bar will not be updated. You can, however, look up instance and class variables by name: @foo1 = "whee" @foo2 = "la" answer = '@foo1' puts instance_variable_get( answer ) I think that's about as close as you're going to get (without using eval).