03 2012 档案

perl中heredoc
摘要:在成块打印文本的时候特别有用。格式print <<EOFyou text go hereEOFsub usage{ print <<EOF;Usage: test.pl -c config, -f file -l lines -c config file -f file name -l number of linesEOF}NOTE: the last EOF must start at the beginning of the line!!!you can use other words instead of EOF 阅读全文

posted @ 2012-03-30 10:08 perlman 阅读(1039) 评论(0) 推荐(0)

在shell帮助文档中搜索内容
摘要:比如想查看ls的-l参数,可以先 man ls,然后再/-l即可。和vi中的搜索一样。 阅读全文

posted @ 2012-03-30 09:45 perlman 阅读(633) 评论(0) 推荐(0)

perl正则表达式返回多个匹配
摘要:返回()中的文本。方法一:sub test { my $text = '(zdd)(autumn)(123)(456)'; while ($text =~ /\((.*?)\)/g) { print $1, "\n"; }}方法二:sub test1 { my $text = '(zdd)(autumn)(123)(456)'; my @matches = ($text =~ /\((.*?)\)/g) ; foreach my $match (@matches) { print $match, "\n"; }}== 阅读全文

posted @ 2012-03-26 15:16 perlman 阅读(7334) 评论(0) 推荐(0)

Vim正则表达式
摘要:== 阅读全文

posted @ 2012-03-14 14:38 perlman 阅读(234) 评论(0) 推荐(0)

导航