From: "Jan E." Date: 2012-07-11T02:09:16+09:00 Subject: Re: Array in an array - how to assign to individual array? Champak Ch wrote in post #1068162: > But having separate global arrays for array1 and array2 will enable me > to access the data anywhere, even if the hash keeps changing. What exactly keeps changing? What might a different version of myhash look like? And what are the actual data behind this all? To me myhash looks like a table with "array1" and "array2" being the columns and the hashes being the rows. And now you want "snapshots" of the columns at a certain point of time. If that's the case, you should actually use a table object as a model for the data. Internally you might store the data as a hash of the form { "column_name_1" => [value_11, value_12, ...], "column_name_2" => [value_21, value_22, ...], ... } This would also allow you to easily access the columns. I think having nested hashes or arrays is almost always a bad idea, because they're hard to understand, hard to process and unsafe. It's mostly better to have a specialized object, which encapsulates the data and enforces a certain format. -- Posted via http://www.ruby-forum.com/.