From: aero6dof@... (Alan Chen) Date: 2003-09-26T01:02:21+09:00 Subject: Re: Setting "variable" global variable ? This is probably a stupid question, but wouldn't it be simpler to use a global hash? $myapp[name] = val - alan Johan Holmberg wrote in message news:... > Hi ! > > I wonder if there is any way in Ruby of setting a "variable" global > variable at runtime, without using "eval". > > For example, could the following be done without "eval": > > def my_set_global_variable(name, val) > eval "#{name} = #{val.inspect}" > end > > my_set_global_variable("$foo", [1,2,3]) > > p $foo # gives [1, 2, 3]