in reply to Interpolating $1 within a variable

You need the /ee modifier. The first /e changes $x to $1, and the next interpolates in the value in $1. You do not need to go qq("$x"). qq/foo/ is the same as "foo" so you effectively have "\"foo\"" You only need to go $x vis

$_=q(ab cdefg); $x=q($1,); s/(^\w+)/$x/ee; print;

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Interpolating $1 within a variable
by s0ttle (Scribe) on Oct 27, 2001 at 17:22 UTC
    Yes, I realized all of that, but I still don't get the comma in the output.
    :\