On Wed, Jan 17, 2001 at 01:17:12PM -0500, Kee Hinckley wrote:
> #!/usr/bin/perl
> $a = "abc";
> $b = ".(b).";
> $c = "the middle letter was \$1!";
> $a =~ s/$b/eval("\"$c\"")/e;
> print "$a\n";

> Anyone have a better way?

use a double e on the regex:

$a =~ s/$b/"\"$c\"\"/ee;

It's still pretty ugly, but it's nicer syntax...


Tony

-- 
-----------------------------------------------------------------------------
 Tony Bowden | Belfast, NI | [EMAIL PROTECTED] | www.tmtm.com | www.blackstar.co.uk
                        he knows the use of ashes, he worships God with ashes
-----------------------------------------------------------------------------

Reply via email to