From: Robert Klemme Date: 2005-04-07T00:49:41+09:00 Subject: Re: Interpolating a string loaded from a text file "John Elrick" schrieb im Newsbeitrag news:1112801469.561320.13590@z14g2000cwz.googlegroups.com... > Hoping you guys can help out here. Is there any way to interpolate a > string that is loaded dynamically? > > I know that in Ruby I can do this: > > my_message = 'Hello World' > my_template = "The message is #my_message" > puts my_template <== The message is Hello World > > But what I want to do is > > my_message = 'Hello World' > my_template = > File.readlines('my_template_file.txt').HOW-CAN-I-FORCE-INTERPOLATION??? > puts my_template <== The message is Hello World > > > Anyone have any ideas? Or am I missing something blatantly obvious? How about: eval "%Q{" + File.read('my_template_file.txt') + "}" Kind regards robert