Greetings,
Consider the following snippet:
$orig='aaa([\+\-]{1})bbb';
$qre="\\Q([\\+\\-]{\\E\\d\\Q})\\E";
$bre='\(\[\\\\\+\\\-\]\{\d\}\)';
$str=$orig;
$str =~ s!\Q([\+\-]{\E\d\Q})\E!!;
print "Replace against literal quoted: $str\n";
$str=$orig;
$str =~ s!\(\[\\\+\\\-\]\{\d\}\)!!;
print "Replace against literal bslashed: $str\n";
$str=$orig;
$str =~ s!$qre!!;
print "Replace against variable quoted => $qre <=: $str\n";
$str=$orig;
$str =~ s!$bre!!;
print "Replace against variable bslashed => $bre <=: $str\n";
Running this (with either 5.6.1 or 5.8.0RC1:
c:\temp> D:\perl58\bin\perl.exe re.pl
D:\perl58\bin\perl.exe re.pl
Replace against literal quoted: aaabbb
Replace against literal bslashed: aaabbb
Replace against variable quoted => \Q([\+\-]{\E\d\Q})\E <=: aaa([\+\-]
+{1})bbb
Replace against variable bslashed => \(\[\\\+\\-\]\{\d\}\) <=: aaabbb
c:\temp>perl re.pl
perl re.pl
Replace against literal quoted: aaabbb
Replace against literal bslashed: aaabbb
Replace against variable quoted => \Q([\+\-]{\E\d\Q})\E <=: aaa([\+\-]
+{1})bbb
Replace against variable bslashed => \(\[\\\+\\-\]\{\d\}\) <=: aaabbb
C:\temp\perl -v
This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Uh? Am I missing something?
Cheers,
alf
You can't have everything: where would you put it?