From: Chris White Date: 2011-07-30T11:12:49+09:00 Subject: Re: Dynamic creation of variables > 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. I would recommend making a module, then setting module constants for your element symbols to be mapped to objects. Here is a sample I threw together: module Chemistry     class Element         attr_reader :name         attr_reader :mass         attr_reader :symbol         def initialize(name,mass,symbol)             @name = name             @mass = mass             @symbol = symbol         end     end end elements = [     Chemistry::Element.new("hydrogen", 1.0079, "H"),     Chemistry::Element.new("lithium", 6.941, "Li") ] elements.each do |element|     Chemistry.const_set(element.symbol, element) end include Chemistry puts Li.name Please note the include Chemistry which makes the "Li.name" access possible. This has the advantage of being able to use these constants in other scripts where someone might want to use the H constant for a different purpose, then they can access it like this: Chemistry::Li.name Regards, Chris White Twitter: @cwgem