<pre name="code" class="html">[root@backoffice01 ~]# cat a1.pl
my $_="aa
2bb
3cc";
if ($_=~/aa$\n^2bb\n3cc/){print "1111111111\n"};
if ($_=~/aa\n^2bb\n3cc/m){print "2222222222\n"};
[root@backoffice01 ~]# perl a1.pl
2222222222
/m 当然多行处理
/m 修改荀彧^和$来立即匹配一个嵌入的换行前后
分别的,
/^=head[1-7]/m 会匹配模式不只是记录的开头,但任何地方在一个新行后
The /m modifier allows ^ and $ to match immediately before and after an embedded newline, respectively. /^=head[1-7]/m would match that pattern not just at the beginning of the record, but anywhere
right after a newline as well
转载于:https://www.cnblogs.com/zhaoyangjian724/p/6199119.html