From: Paul Lutus Date: 2006-12-15T03:55:11+09:00 Subject: Re: Hash/2-d array help! Just Maz wrote: > Jason Roelofs wrote: >> hash = { >> England => [Liverpool, London, Plymouth], >> France => [Rennes, Paris] >> } >> >> Jason > > Ah....now that's a lot simpler then I thought. > How would I then retrieve these values? > > puts hash gives error as does puts hash[England] or puts > hash{England}...Are they counted in anyway like hash{england[1]}? If you create a hash as the prior poster described: >> hash = { >> England => [Liverpool, London, Plymouth], >> France => [Rennes, Paris] >> } Then you retrieve an ordinary array (not a hash) by using one of the keys: array = hash["England"] Now "array" contains [Liverpool, London, Plymouth], and you retrieve one of them using an index number -- array[0] retrieves "Liverpool". -- Paul Lutus http://www.arachnoid.com