标签:
#! /usr/bin/perl use strict; use utf8; #1 符号:$& $` $‘ my $str="my name is hello world,and her name is hello world"; if($str=~m/name/g){ print $`,"\n";#匹配到的字符串的前面部分 print $‘,"\n";#匹配到字符串的后面部分 print $&,"\n";#匹配到的字符串 } #result: my is hello world,and her name is hello world name
标签:
原文地址:http://www.cnblogs.com/datacatcher/p/4211520.html