From: Robert Klemme Date: 2006-11-04T08:20:16+09:00 Subject: Re: Accessing a hash -- Beginner don wrote: > I want to access a hash via a gets command. A simplified > example, for a hash named, "test": > > print 'hash name: ' > hash_var = gets.chomp # enter 'test' here > > puts hash_var # <-- nil > puts test # <-- the contents of the hash > > One problem I see is hash_var is class String, while test is > class Hash. I cannot figure out how to make hash_var class > Hash. I'm not even sure if I am on the right track. I > would appreciate any help. There is not a single Hash instance in your code. Also "test" is not set, hence it's interpreted as a method call: $ ruby -e " print 'hash name: ' > hash_var = gets.chomp # enter 'test' here > > puts hash_var # <-- nil > puts test # <-- the contents of the hash > " hash name: foo foo -e:5:in `test': wrong number of arguments (ArgumentError) from -e:5 What is your problem? What are you trying to achieve? Regards robert