From: "Peña, Botp" Date: 2009-03-04T11:10:55+09:00 Subject: Re: expanding environment variable From: Daniel Schoch [mailto:trash@tekwissusa.com] # Dominik Honnef wrote: # > | >>> DIR=x FILE=y.z irb # > | >> s = "$DIR/test/$FILE".gsub(/\$\w+/) {|m| ENV[m[1..-1]]} # > | => "x/test/y.z" # Perfect, thanks. I sometimes have a hard time with those # efficient one-liners. It's all so cryptic. if we are careful w constants (wc we should), we can do, s = "DIR/test/FILE".gsub(/[A-Z]+/) {|m| ENV[m]} (ok, ok, you guessed it, i hate dollar notations =) kind regards -botp