Perl学习笔记(2)
时间:2005-12-09 来源:zhousqy
Three of predefined read-only variables:
很简单的E文,就不翻译了:-)
1: $&, which is the part of the string that matched the regular expression
2: $`, which is the part of the string before the part that matched
3: $', which is the part of the string after the part that matched
For example:
$_ = "this is a sample string";
/sa.*le/; # matches "sample" within the string
# $` is now "this is a "
# $& is now "sample"
# $' is now " string"
相关阅读 更多 +