我的新博客

perl学习笔记

一.正则表达式

匹配一个文件中的某个单词,并打印出来

 1 #!/usr/bin/perl
 2 
 3 use strict;
 4 use warnings;
 5 use v5.14;
 6 
 7 open(FILE, "< temp.pl");
 8 while(<FILE>){
 9     #print if /\bdata\b/;
10     #next  if ~ /^#/;
11     print if (/\bis\b/ && /\bSINK\b/) ;
12 }
13 
14 close(FILE);

 

posted @ 2016-09-07 22:39  Leon#0534  阅读(309)  评论(0编辑  收藏  举报

我的新博客

专注天线学习,欢迎交流 yangli0534@gmail.com - 创建于 2010年

我永远是茫茫EE领域的一名小学生。