以下是我的代码:
my $string1 = '<td><a href="http://www.aaa.com/downloads/details.aspx?FamilyID=a1b2c3">abcdefg</a><br />(123456)</td>';
my $string2 = 'http://www.aaa.com/downloads/details.aspx?FamilyID=a1b2c3';
print "Before string substitution:\n$string1\n";
$string1 =~ s/$string2//;
print "After string substitution:\n$string1\n";
和实际输出:
Before string substitution:
<td><a href="http://www.aaa.com/downloads/details.aspx?FamilyID=a1b2c3">abcdefg</a><br />(123456)</td>
After string substitution:
<td><a href="http://www.aaa.com/downloads/details.aspx?FamilyID=a1b2c3">abcdefg</a><br />(123456)</td>
我的期望:
Before string substitution:
<td><a href="http://www.aaa.com/downloads/details.aspx?FamilyID=a1b2c3">abcdefg</a><br />(123456)</td>
After string substitution:
<td><a href="">abcdefg</a><br />(123456)</td>
有人可以告诉我我的代码有什么问题吗?
谢谢。