From: RichardOnRails Date: 2011-01-17T14:30:19+09:00 Subject: A tad of meta-programming needed I've got the following hash set up and it works fine. But this took more typing than programming. h = {:name=>$1, :n_shares=>$2, :opened_MDY=>$3, :closed_MDY=>$4, :proceeds=>$5, :cost=> $6, :gain_Loss=>$7 } So I'd like to get the following to work: field_names =%w h = {} (1..field_names.size).each { |i| h[field_names[i]] = eval($ + i.to_s) } But concatenating the character "$" with the value of i converted to a string, followed be evaluating that as a local variable isn't working as I coded it. Can it be easily corrected? Thanks in Advance, Richard