YOU*_*YOU 17
使用s///e- 评估修饰符,你可以在第二部分放置任意perl代码.
$x = "this is a test";
$x =~ s/(test)/reverse($1)/eg;
print $x;
//this is a tset
Run Code Online (Sandbox Code Playgroud)
参考:http://perldoc.perl.org/perlretut.html#Search-and-replace
| 归档时间: |
|
| 查看次数: |
996 次 |
| 最近记录: |