Re: perl: problem with s/// and variable interpolation
Joost Kooij writes:
> > #!/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.
I had not, and it works.
====
$TRANSLATION = '\$1;\$2';
$str = "ab";
eval "\$str =~ s{(.)(.)}{$TRANSLATION}";
====
Thanks to Joost and Qrczak for their help !
--
Yann Dirson <ydirson@a2points.com> | Stop making M$-Bill richer & richer,
alt-email: <dirson@univ-mlv.fr> | support Debian GNU/Linux:
debian-email: <dirson@debian.org> | more powerful, more stable !
http://www.a2points.com/homepage/3475232 | Check <http://www.debian.org/>
--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: