From: thomas Mulvaney Date: 2011-07-30T10:18:32+09:00 Subject: Dynamic creation of variables Hi everyone! I am building a interactive shell for chemistry related tasks and am stuck. The program loads all the elements of the periodic table and there properties, into an array of objects. Eg: elements[0] is the element hydrogen. puts elements[0].name #=> "hydrogen" puts elements[0].mass #=> 1.0079 puts elements[0].symbol #=> "H" I am also making them available by the symbol as follows @elements.each do |e| instance_variable_set("@" + e.symbol, e) end thus: puts elements[0].name #=> "hydrogen" puts @H.name #=> "hydrogen" But i would prefer it if the elements were loaded up as normal variables without the '@' in front. is this possible? Thanks in advance, Tom -- Posted via http://www.ruby-forum.com/.