At 7:00 PM +0200 10/18/01, Pascal Oberndoerfer wrote:
>But I am unable to do:
>
> $pattern = 'search_for(but_preserve)';
> $replace = 'replace_with $1';
> s/$pattern/$replace/;
>
>
>It would be very helpful if I could to this as the grouping in the
>"$pattern" varies as well as the placement of the corresponding
>variables $1, $2, ...
Try quoting this way:
'replace_with ' . $1;
or
"replace_with $1";
Otherwise $replace is literally <replace_with $1>, that is, $1 is not
interpolated into 'but_preserve'; it's just "dollar-sign one".
HTH
1;
- Bruce
__bruce_van_allen__santa_cruz_ca__