首页 > 其他 > 详细

perl中的奇怪符号

时间:2015-01-08 19:31:10      阅读:212      评论:0      收藏:0      [点我收藏+]
#! /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

 

perl中的奇怪符号

原文:http://www.cnblogs.com/datacatcher/p/4211520.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!