Well you can not expect that anything you write in a file can be seen as ruby expression.
But $VAR1 = "value" should do
Howerver I do not feel your approach is a good one. I can not see what you win with it.
but here we go:
content of t1.txt:
$VAR1 = "var1"
content if use_t1_txt.rb
inFile = File.open("t1.txt", "r")
vars = []
inFile.readlines().each do |line|
eval line
end
print("VAR1 = #{$VAR1}\n")
output:
ruby use_t1_txt.rb
VAR1 = var1
However it seems you want to use e.g yaml really.
http://ruby.lickert.net/yaml/index.htmlRegards
Friedrich