19 lines
376 B
Perl
19 lines
376 B
Perl
|
#!/usr/bin/perl
|
||
|
|
||
|
$name="aAbBcCbB";
|
||
|
$_="aAbBcCbB";
|
||
|
|
||
|
print "------first--------\n";
|
||
|
if(/bB/){ # 匹配完第一个bB就结束
|
||
|
print "pre match: $` \n";
|
||
|
print "match: $& \n";
|
||
|
print "post match: $' \n";
|
||
|
}
|
||
|
|
||
|
print "------while--------\n";
|
||
|
while(/bB/g){ # 将迭代两次
|
||
|
print "pre match: $` \n";
|
||
|
print "match: $& \n";
|
||
|
print "post match: $' \n";
|
||
|
}
|