Alexei A. Frounze wrote:
Here's a sample program to show the problems I'm having with regexps:
my $s = "a\tb";
$s contains a three character string, the 'a' character, the TAB
character and the 'b' character.
my $m1 = "\t";
$m1 contains a single TAB character.
my $m2 = "\\t"; # both "\t
Here's a sample program to show the problems I'm having with regexps:
my $s = "a\tb";
my $m1 = "\t";
my $m2 = "\\t"; # both "\t" and "\\t" are treated specially
my $r1 = "\t";
my $r2 = "\\t";
my $s1 = $s;
my $s2 = $s;
$s1 =~ s/$m1/$r1/;
$s2 =~ s/$m1/$r2/;
print "\"$s\" =~ s/$m1/$r1/ -> \"$s1\"\n"