From: fastjack@... (Martin Maciaszek) Date: 2002-02-06T17:41:42+09:00 Subject: expanding variables in strings I have a long list of variables that gets used at several places in my program. I figured that it might be a good idea to put the names of those variables in an array. So I ended up with the following: %w{ foo bar baz}.collect { |x| "'\#{" + x + "}'"}.join(", ") --> "'#{foo}', '#{bar}', '#{baz}'" This returns a nice string that I would be otherwise cut&pasting all over my program. But now I need to expand those variables. I've looked up the String class but couldn't find anything useful (except trying to rewrite those expensions from scratch) Cheers Martin