| ||
##确定变量匹配(不匹配默认变量$_)
if($my_varable =~/****/);
##替换文本
$_="aaabbb";
s/aaa/bbb/;
print $_;
成功替换为真失败为假
split函数额能够根据给定的模式拆分字符串,split /separator/ ,$string;
my $string="aaa : bbb : ccc":
my @sp_string=split /:/ ,$string;
###以:为间隔分离字符串,存于列表中
默认split匹配模式为\+s+\,默认变量为$_
split /\s+/,$_;
当一行字符串中遇到//中匹配的字符,该位置就是一个结尾存放于列表中
join函数:连结多个字符串
my $new_string=join ":",@string;
#将@string中的多个字符串用:连接起来
##获取匹配的字符串
$_="aaa bbb,ccc";
my($a,$b,$c)=/(\S+) (\S+), (\S+)/;
my @word = ($text =~/([a-z]+)/ig);
#将text中的所有匹配条目以列表形式存于word中
my %word = ($text=~/(\w+)\s+(\w+)/g)
#以键值对的方式存与哈希变量中