From: "Jesús Gabriel y Galán" Date: 2012-07-11T01:23:54+09:00 Subject: Re: Array in an array - how to assign to individual array? On Tue, Jul 10, 2012 at 6:16 PM, Champak Ch wrote: > I have 2 arrays. > > a=["array1", "array2"] that stores the names of arrays as a string and > > b=[["1","2"],["3","4"]] that has the values for each of these arrays. > > I want to access individual arrays specifically and the contents of a > and b keep changing. So, I have to store it in a different array. > I want to create 2 new arrays array1 and array2 with values from b. Like > this. > > array1= ["1","2"] > array2= ["3","4"] > > Can you please suggest some ideas? I'm not really sure I understand what you want to achieve, but when you want to "name" things, a possible solution is a hash: arrays = {"array1" => ["1", "2"], "array2" => ["3", "4"]} arrays["array1"] # => ["1", "2"] arrays["array2"] # => ["3", "4"] If you could explain with a bit more detail what is the problem you need to solve, maybe we can come up with better solutions. Jesus.