From: David Alan Black Date: 2001-11-21T03:16:18+09:00 Subject: [ruby-talk:25931] Re: Why does #{a} not evaluate when read from file? [I mailed this answer a while ago but it hasn't shown up on the list.] Hello -- The short answer is: because String handling in Ruby is sane :-) On Wed, 21 Nov 2001, Jim Freeze wrote: > Hi > Here I am again. > > I have a file with the line '#{a}' in it. > I would like the variable 'a' to be evaluated > when printed. Be careful what you wish for. def echo print "Type something: " s = gets puts "You typed: #{s}" end echo Type something: `rm -rf *` It's actually good that strings remain inert under these conditions, instead of performing a level of interpolation on themselves. You can always do some eval'ing. (There was some discussion of this fairly recently -- see ruby-talk:23658.) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav