How can I create a multi-dimensional hash table?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rotaryfreak
    New Member
    • Oct 2008
    • 74

    How can I create a multi-dimensional hash table?

    Hi,

    I'm new to ruby and i've been experimenting on different ways on how to do this, but sadly nothing is working. I would like to create a multi-dimensional hash table in which i can access my members so that the output looks like this

    [Key] [value1] [value2] [value3] [value4]
    key 1 some val some val some val some val
    key 2 some val some val some val some val
    key 3 some val some val some val some val
    key 4 some val some val some val some val
    key 5 some val some val some val some val
    . . . . .
    . . . . .
    . . . . .
    n n n n n

    this hash table needs to be created in a loop. How would i do this?

    Additional information: i need to use a has table because i absolutely need to index value1, value2, value3, value4 by key

    any examples or documentation would help as i've tried google and i cant find anything relevant
  • improvcornartist
    Recognized Expert Contributor
    • May 2007
    • 303

    #2
    Would a hash of arrays work?

    Comment

    Working...