必知1
因为Perl 十分简洁,所有有很多的黑魔法。下面这些东西是你一定要知道的。
可以忽略,但是大项目的时候必须要培养的意识
- use strict; use warnings;
- END and =cut =head 来写注释(POD 格式)
Perl 要关注的论坛和 Perl 一些牛人(持续更新):
论坛:
China Unix
Perl Monks
Perl 大牛:
szabgab.com : 这个网站是那个大牛的集合性的网站
perl maven.com 网站是这个网站的持续性的网站
Perl 三部曲
小骆驼 --> 中骆驼 --> 大骆驼
注意:如果你只是要做一些生物信息的话,不想深入的去了解Perl 的话,看完小骆驼就够了!
关于造轮子的问题:
perl 自己就有很多的轮子,就是那些自带的核心Perl模块。在这些模块中也有一些神器,可以利用。
** Perl 自带的模块与Perl 神器**
首先说 Perl 的神器:
- Perl::Tidy : Many people say perl code is really ugly and give is a name "write-only language". OK here you can get a method to customolize your code or others' code to let the codes you interest be much more tidy.
- Perl::Critic : advice for your code.
- Smart::Comments : A really smart comments. you can control your code to be the comments or debuging your scripts. It's worthwhile to study it.
Perl 自带的核心模块
P.S. 比自己写的好太多了!
-
List::Util : This module inclues the most common functons such as sum,max. You don't need to constrct the repeat wheels. Note: the functions here is modified by the C, so I suppose your code is not run as fast as he. And also, if you think it's not enough, than you can go to: List::MoreUtils
-
Data::Dumper : see the complex data structure. An alternative way is to enter the dubug mode (perl -d), than use
x $var
to see the structure. -
**Getopts::std : ** Easily get the options
use Getopt::Std;
getopts('i:o:p:');
our($opt_i, $opt_o, $opt_p);
my $inputfile = $opt_i;
my $outputfile = $opt_o;
my $parameter_value = $opt_p || "20";
print "$_\n" for $inputfile, $outputfile, $parameter_value;
- Diagnostic和Crap
用来追踪错误
网友评论