10 Jul 2012 18:38
Re: Array in an array - how to assign to individual array?
Champak Ch <lists <at> ruby-forum.com>
2012-07-10 16:38:07 GMT
2012-07-10 16:38:07 GMT
Thank you for the quick response. I actually have the data as a hash.
But the hash keeps changing and I need to use the names and values
across multiple scripts. Thats the reason I need to save it elsewhere.
myhash=[{"array1"=>"1","array2"=>"3"},{"array1"=>"2","array2"=>"4"}]
So, I fetched all names and values into 2 different 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.
But having separate global arrays for array1 and array2 will enable me
to access the data anywhere, even if the hash keeps changing.
--
--
Posted via http://www.ruby-forum.com/.
RSS Feed