From: "Michael W. Ryder" <_mwryder@...> Date: 2009-03-14T10:37:53+09:00 Subject: Problem With eval and each_index I am trying to set a group of variables to values stored in a tab delimited string. I have no problem splitting the string into an array, call it e, or in putting the variable names in a second array, call it v. The problem arises when I try to merge the two together. If I enter: irb(main):073:0> p v ["name", "street", "city", "state", "zip", "*", "telephone"] => nil irb(main):074:0> p e ["John Doe", "123 Main St", "Anywhere", "US", "01234-5678", "ab123", "1234567890"] => nil irb(main):075:0> eval "#{v[0]} = e[0]" => "John Doe" irb(main):076:0> p name "John Doe" => nil it works as I want. But when I try: irb(main):077:0> v.each_index {|i| eval "#{v[i]} = e[0]"} => ["name", "street", "city", "state", "zip", "*", "telephone"] and then enter: puts zip it returns with a NameError saying that the variable was undefined. Am I missing something, or should I be trying a different method to accomplish this?