From: Gary Wright Date: 2007-02-20T11:15:11+09:00 Subject: Re: Strange question: Convert string to array name On Feb 19, 2007, at 7:20 PM, kenbo wrote: > I want to use foo to access an array called bobo. I will have bobo > defined already. This type of question seems to come up periodically on the list but I never seem to run into in while coding. I tend to think that in most (but not all) cases the need to reach for eval indicates some larger design issue. In your case, I would ask why you are resorting to using several local variables that you need to distinguish by name rather than simply using a hash to organize things? arrays = {} array[:bobo] = [1,2,3] array[:foo] = [4,5,6] array[:foo][2] # 5 Perhaps if you gave the list the 'bigger' picture they could suggest a solution that doesn't require 'eval'. Gary Wright