\s 简写擅长处理空白,它相当于[\f\t\n\r ] 换页 制表 换行 回车 空格 \s+ 匹配一个以上的空白 捕获变量: [oracle@jhoa perl]$ cat a13.pl $_ = "Hello there,neighbor"; if (/(\S+) (\S+),(\S+)/) { print "words were $1\n"; } [oracle@jhoa perl]$ perl a13.pl words were Hello
\s 简写擅长处理空白,它相当于[\f\t\n\r ] 换页 制表 换行 回车 空格 \s+ 匹配一个以上的空白 捕获变量: [oracle@jhoa perl]$ cat a13.pl $_ = "Hello there,neighbor"; if (/(\S+) (\S+),(\S+)/) { print "words were $1\n"; } [oracle@jhoa perl]$ perl a13.pl words were Hello