From: Joseph McDonald Date: 2001-10-23T04:14:48+09:00 Subject: [ruby-talk:22987] assigning variables Hi, the following is not working as I'd like: def setvars(vars) str = "" vars.each do |k,v| str << "#{k} = #{v}\n" end puts str eval str end a = ['an' , 'array'] b = ['another' , 'array'] setvars( { 'a' => a, 'b' => b} ) ======== ./junk.rb a = anarray b = anotherarray ./junk.rb:9:in `setvars': (eval):1:in `setvars': undefined local variable or method `anarray\ ' for # (NameError) What I would like is for setvars to have a variables called 'a' and 'b' that point to the arrays that were passed in, not a string version of the array. How do I make that happen? thanks, -joe