[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: perl: problem with s/// and variable interpolation



On Thu, 30 Apr 1998, Yann Dirson wrote:

> I wrote a sample script whose behaviour seems strange to me.  At least
> I can't find in the doc why it behaves so, nor what I should write to
> get the expected result.
> 
> ==== The sample script
> #!/usr/bin/perl
> 
> $TRANSLATION = '\1;$2';
> $str = "ab";
> $str =~ s{(.)(.)}{$TRANSLATION};

[snip]

Have you tried wrapping the substitution statement with an "eval" 
construct yet? I think that should make it work.

Cheers,


Joost



--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: