From: Lloyd Zusman Date: 2009-03-18T04:52:08+09:00 Subject: Re: Interpolating $1, etc., from within a gsub block Lloyd Zusman asfast.com> writes: > [ ... ] > > string.gsub!($fromre) { > |x| > $replcount += 1 > $repl > } > Well, I came up with the following, but I'm still wondering if there is a more elegant way to do this: string.gsub!($fromre) { |x| $replcount += 1 eval "$result = \"#{$to}\"" $result } Then, I have to invoke my program as follows: myprog 'abc(\S+)def' 'NEW-#{$1}-MATCH' Is this the best I can do, or is there something more elegant? Thanks. -- Lloyd Zusman ljz@asfast.com God bless you.