首页 perl基本语法

perl基本语法

举报
开通vip

perl基本语法 Perl 的基本语法 前言: 这篇文章是花了我很多时间、费了我很多心血才完成的,虽然连我自己都觉得无 法达到尽善尽美的境界,但希望能帮助大家入门,稍微了解到 Perl 到底是个什 么样的东西,Perl到底有那些强大的功能,那么这篇文章的目的就达到了。 我 分做资料型态、控制叙述、副程式、I/O 和档案处理、Regular Expressions、 Spectial Variables、Help这几部分来讲解,但只是叙述了一些Perl的基本语 法而已,Perl 活泼的特性和程式的技巧就无法一一详述了,甚为缺憾。 ...

perl基本语法
Perl 的基本语法 前言: 这篇文章是花了我很多时间、费了我很多心血才完成的,虽然连我自己都觉得无 法达到尽善尽美的境界,但希望能帮助大家入门,稍微了解到 Perl 到底是个什 么样的东西,Perl到底有那些强大的功能,那么这篇文章的目的就达到了。 我 分做资料型态、控制叙述、副程式、I/O 和档案处理、Regular Expressions、 Spectial Variables、Help这几部分来讲解,但只是叙述了一些Perl的基本语 法而已,Perl 活泼的特性和程式的技巧就无法一一详述了,甚为缺憾。 (1) 资料型态(Data type): Perl 的资料型态大致分为四种:Scalar、Scalar Array、Hash Array、 References, 看起来虽少但用起来却绰绰有余。尤其在写Perl程式时可以不必 事先宣告变数,这一点对刚学程式语言的人甚为方便, 不过为了以后程式除错 和维护方便,我建议你还是养成事先宣告变数的习惯比较好。 (a) Scalar: 纯量变数是Perl里最基本的一种资料型态,它可以代 关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf 一个字元、字串、整数、 甚至浮点数,而 Perl 把它们都看成是一样的东东! 你甚至可以混着用,不可思 议吧。例如: # 井字号开头的后面都是注解。 # 纯量变数以$开头。 # my 是一种宣告变数的方式,它可以使变数区域化。 # 宣告变数时若不加 my 或 local 则 Perl会把它当作全域变数使 用。 # 习惯上,我们会将字串用双引号括起来,而数值就不用加引号。 my $x="abc"; my $x=123; my $x=4.56; 那么程式怎么判断这是数值还是字串呢? 其实不是程式判断,而是你自己要判 断。Perl 分别提供了一堆运算子来处理数字和字串,你必须知道这个变数是数 值或字串,才能使用个别的运算子来对变数做运算。我分别列出字串运算子和数 值运算子,好让大家能区分它们的不同。 ◎字串运算子 String Operator Purpose x Returns a string consisting of the string on the left of the operand, repeated the number of times of the right operand. . Concatenates the two strings on both sides of the operator. eq Returns True if the two operands are equivalent, Falseotherwise. ne Returns True if the two operands are not equal, Falseotherwise. le Returns True if the operand on the left is stringwise less than the operand on the right of the operator. Returns False otherwise. lt Returns True if the operand on the left is stringwise less than or equal to the operand on the right of the operator. Returns False otherwise. ge Returns True if the operand on the left is stringwise greater than or equal to the operand on the right of the operator. Returns False otherwise. gt Returns True if the operand on the left is stringwise greater than the operand on the right of the operator. Returns False otherwise. cmp Returns -1, 0, or 1 if the left operand is stringwise lessthan, equal to, or greater than the right operand. , Evaluates the left operand, the evaluates the right operand.It returns the result of the right operand. ++ Increments the string by one alphabetic value. ◎数值运算子 Value Operator Purpose + Computes the additive value of the two operands. - Computes the difference between the two operands. * Computes the multiplication of the two operands. / Computes the division between the two operands. % Computes the modulus(remainder) of the two operands. = = Returns Ture if the two operands are equivalent, Falseotherwise. != Returns Ture if the two operands are not equal, Falseotherwise. <= Returns Ture if the operand on the left is numerically less than or equal to the operand on the right of the operator. Returns False otherwise. => Returns Ture if the operand on the left is numerically greater than or equal to the operand on the right of the operator. Returns False otherwise. < Returns Ture if the operand on the left is numerically less than the operand on the right of the operator. Returns False otherwise. > Returns Ture if the operand on the left is numerically greater than the operand on the right of the operator. Returns False otherwise. < = > Returns -1 if the left operand is less than the right, +1 ifis it greater than, and 0(False) otherwise. && Performs a logical AND operation. If the left operand isTrue m then the right operator is not evaluated. || Performs a logical OR operation. If the left operand is Truem then the right operator is not evaluated. & Returns the valueof the two operators bitwise ANDed. | Returns the valueof the two operators bitwise ORed. ^ Returns the valueof the two operators bitwise XORed. ++ Increment operator. Increments the variable's value by 1. -- Decrement operator. Decrements the variable's value by 1. ** Computes the power of the left-hand value to the power ofthe rihght-hand value. += Adds the value of the right-hand operand to the value of theleft-hand operand. -+ Subtracts the value of the right-hand operand to the valueof the left-hand operand. *= Mlutiplies the value of the left-hand operand to the valueof the right-hand operand. >> Shifts the left operand right by the number of bits that isspecified by the right operand. << Shifts the left operand left by the number of bits that isspecified by the right operand. ~ Performs a 1s complement of the operator. This is a unaryoperator. (b) Scalar Array: 纯量阵列,阵列内的每一个元素都是Scalar variable。宣告及使用方式如下: # 纯量阵列以 @ 开头。 my @array; my @array=qw(a b c d); # qw 函数会将其后的每个元素用逗点隔开,效果就像下面这行。 my @array=("a","b","c","d"); # 当然你也可以一个个元素宣告,下面就是存取每一个元素的方法。 # 因为阵列中的每一个元素都是纯量变数,所以要以 $ 开头, # 刚开始容易搞混,请注意。 $array[0]="a"; $array[1]="b"; $array[2]="c"; $array[3]="d"; # 使用for loop印出阵列内每个元素的值。 for($i=0; $i<=$#array; $i++) { print "$array[$i]\n"; } 看到$#array 这个奇怪的东东没? 这是 Perl 的一个特殊用法,代表这个阵列最 后一个元素的注标。由于Perl不必事先宣告变数,也不必预先宣告阵列的大小, 甚至可以随时增加新元素,那我们怎么知道这个阵列到底有多大呢? 透过这个特 殊变数我们可以得知这个这个阵列最后一个元素的注标,自然而然也就知道这个 阵列究竟有多大了。 另外Perl只定义了一维阵列的语法,二维以上只能用指标 间接来达成。 (c) Hash Array(Associative Array): 杂凑阵列也叫做相关阵列,它和一般阵列没什么不同,差别只是在它的索引值用 的是字串,而非一般阵列所用的整数值, 因此相关阵列不像一般阵列一样有次 序的概念,它没有所谓的第一项资料这种说法。它就相当于把一堆变数组合成一 个 group,然后我们可以透过索引字串存取这个 group 每一个元素的值。 相关 阵列的宣告及使用方式如下: # 相关阵列是以 % 符号开头的。 my %hash; # => 这个符号是Perl5新增的,是为了相关阵列量身定做的, # 因为索引和元素值都是纯量,若使用 => 这个符号, # (索引=>元素值) 两两对应,就不容易发生失误。 my %hash=("i1"=>"aaa","i2"=>"bbb","i3"=>"ccc"); # 上面这行的效果和下面这行是一样的。 my %hash=("i1","aaa","i2","bbb","i3","ccc"); # 下面是存取每个元素的方法,注意是用大括号把索引括起来哦。 # 习惯上索引值用单引号、元素值用双引号括起来。 $hash{'i1'}="aaa"; $hash{'i2'}="bbb"; $hash{'i3'}="ccc"; # 下面是使用相关阵列的三个例子: foreach $key (keys %hash) { print "$hash{$key}\n"; } foreach $value (values %hash) while(($key,$value)=each %hash) Perl有上述三个函数可对相关阵列做运算:keys函数可取出相关变数的索引值, 组成一纯量阵列,注意这些由keys函数取出的索引值没有次序性;values函数 可取出相关变数的元素值;each 函数则会取出(索引、元素)对。使用者可视情 况而用。 (d) References(Pointer): Perl 5新增了参考指标的资料型态,使Perl 和 C一样可借由指标建立一些复杂 的资料结构。 普通程式是用不到指标这玩意的,下面也只是简单介绍一下,看 不懂的人可不必深究。 ⊙如何取得变数的位址? $scalarRef=\$scalarVar; $arrayRef=\@arrayVar; $hashRef=\%hashVar; $funcRef=\&funcName; ⊙如何使用指标? print $$scalarRef; print "@$arrayRef"; print $hashRef->{$key}; &$funcRef; ⊙Anonymous Array References:(二维阵列) $arrayRef=[[1,2,3,4],a,b,[x,y,z],c]; print "$arrayRef->[0][0]\t$arrayRef->[2]\t$arrayRef->[3][ 2]\n"; ⊙Anonymous Hash References: $hashRef={a=>aa,b=>bb,c=>cc}; print "$hashRef->{a}\t$hashRef->{b}\t$hashRef->{c}\n"; (2) 控制叙述(Control Statements) (a) Conditional Control Statements:Perl 的条件控制叙述和 C语言很 像,让使用者很快就能掌握它。不过 Perl 比 C 语言又另外多了些实用的语法, 我用底线标出来,大家一看便知: # Expression 就是条件叙述式,Perl和 C一样没有定义布林资料 型态(Boolean data type), # 因此 0 是false、非0 是ture。另外要注意字串运算子和数值运 算子要分清楚哦。 # Code Segment 就是用大括号括起来的一堆指令,也就是一个 Block。 if (Expression) {Code Segment} if (Expression) {Code Segment} else {Code Segment} if (Expression) {Code Segment} elsif (Expression) {Code Segment} else {Code Segment} # elsif 就是 else if # 如果指令(statement)只有一项,我们可以使用倒装句法,看起来 比较简洁。 statement if (Expression); # unless 就是 if not statement unless (Expression); 例: print "HELLO!\n" if ($name eq "friend"); $x-=10 if ($x == 100); 看吧! C 语言有的 Perl 大部分都有,学过 C 的人可以毫不费力的学会 Perl。 (b) Loop Control Statements:Perl 的回圈控制叙述也和 C语言很像,当 然,照例 Perl 也另外多了些实用的语法: # 注意:纯量变数前面要加个 $ 字号,这一点和C语言不一样哦。 for($i=0; $i<=10; $i++) {Code Segment} # foreach 是承袭UNIX的shell script来的, # 第一个引数是纯量变数,第二个引数要用括号括起来,里面是一个纯 量阵列, # 顾名思义它就是把阵列中的每个元素依序传给第一个引数,直到全部 传完。 # 它和 for($i=0; $i<=$#array; $i++) 用法虽然不同,但目的 都是要取出阵列的每个元素。 foreach $i (@array) {Code Segment} # 其实在Perl中,for和foreach是可以混着用的,就看个的人习 惯了。 # 下面这行就等于上面第一个叙述,不过简洁多了,大家可以试着用用 看。 for $i (0..10) {Code Segment} # while控制回圈和后置回圈。 while($i<=10) {Code Segment} do {Code Segment} while(Expression); # Perl也有和 C语言的break和 continue一样的指令,Perl叫 它做 last 和 next (较口语化)。 # last是跳出现在所在的回圈,next则是跳过下面的指令直接执行 下一次的回圈。 while(chomp($i=)) { next if ($i == 5); last unless ($i > 10); } Perl还有提供label(标记)的语法,也就是 goto 指令,不过有经验的programer 并不喜欢用它,我也不建议大家使用,所以就此按下不讲。有兴趣的人请自行查 阅。 还有一点值得注意的是Perl没有提供像C语言一样的 switch 叙述,不过 Perl 的pattern match的功能非常强,所以我建议你直接用 if else 叙述来做 就好了。 (3) 副程式(Subroutines) (a) Syntax: sub NAME {Code} (b) 呼叫副程式: &NAME(para1, para2,...) (c) 参数传递:@_Perl和C一样是采用Call by value的方式,不过因为Perl 不用事先宣告变数,所以建立副程式的时候也不用宣告要传递什么参数。 当主 程式在传递参数给副程式时,Perl 会把括号括起来的参数按顺序放在一个特殊 的全域变数 @_ 阵列中,然后副程式就可以随意使用阵列 @_ 里的参数,例如 $_[0] 是第一个参数, $_[1] 是第二个,或是用 my ($ a1,$a2,$a3,...) = @_;来取出各个参数,当然 my @arg=@_; 或 my %arg=@_; 也是可以的。 由于Perl的语法非常活泼,使得程式在维护时 特别棘手,因此写注解成为一项很重要的工作。 我建议你最好在每个副程式前 面加上对这段副程式的描述,特别是需要传递的参数要注明清楚。 (d) Variable Localization:my or local通常我们在程式中定义的变数都 是全域变数,所以在副程式中若要把变数区域化则要加上 my 或 local 关键字, 例如: my $x=3;,若副程式所用的变数名不小心和主程相同,Perl 会以目 前正在执行的副程式里的变数为优先。 (4) I/O和档案处理 (a) Syntax:open(FILEHANDLE,"Expression"); close(FILEHANDLE);这里的 Expression 是一个叙述加上档案名称,若 Expression只有档案名称没有加上叙述,则预设是唯读。Expressions叙述如下: Expression Effect open(FH, "filename") Opens filename for writing. open(FH, "+>filename") Opens filename for both reading and writing. open(FH, ">>filename") Appends to filename. open(FH, "command|") Runs the command and pipes its output to the filehandle. open(FH, "command|") Pipes the output along the filehandle to the command. open(FH, "-") Opens STDIN. open(FH, ">-") Opens STDOUT. open(FH, "<&=N") Where N is a number, this performs the equivalent of C's fdopen for reading. open(FH, ">&=N") Where N is a number, this performs the equivalent of C's fdopen for writing. 例: # 开启$filename这个档案,若开启失败则印出 die后面的讯息,并 结束程式。 open(FILE, $filename) || die "Can't open file $filename : $!\n"; # 下面是一个十分精简的写法,和 while($_=){print " $_";} 是等效的。 print while(); # 档案开启后要记得随手关闭,这才是写程式的好习惯。 close(FILE); # $!和$_都是Perl的特殊变数,下面会介绍的。 (b) Input:Perl没有特别用来输入的函数,因为Perl在执行程式时,会自动 开启 标准 excel标准偏差excel标准偏差函数exl标准差函数国标检验抽样标准表免费下载红头文件格式标准下载 输入装置,其filehandle定为STDIN,所以在Perl中要输入资料的方 法就是使用: # Perl不会自动去掉结尾的CR/LF,跟 C语言不同,所以要用chomp 函数帮你去掉它。 # 大家常常会忘记这个动作,导致结果跟你想的不一样,要特别注意一 下。 $input=; chomp $input; # 下面是较简洁的写法。 chomp($input=); (c) Output: print "variables or 字串";Perl也有printf()函数,语法和 C语言一模一样,我就不多做介绍了。Perl 另外有个 print 函数,比 printf() 更方便、更好用,包你爱不释手。 Output不外乎是输出到萤幕或档案,用例子 来说明比较容易了解。 # 不用再指定变数的data type,这样不是比printf()方便多了吗? print "Scalar value is $x\n"; # . 是字串加法的运算子,上下这两行是等效的。 print "Scalar value is " . $x . "\n"; # 输出到档案的方法。 print FILE "print $x to a file."; # 下面是print的特殊用法,学自 shell script的用法: print<标签一样。 而当 一行的开头是XXX你取的这个识别字时,才会停止输出。 XXX Perl 也有和 C 一样以 "\" 开头的特殊字元: \t tab \n newline \r return \f form feed \b backspace \a alarm(bell) \e escape \033 octalchar \x1b hex char \c[ control char \l lowercase next char \u uppercase next char \L lowercase till \E \U uppercase till \E \E end case modification \Q quoteregexp metacharacters till \E 另外需要说明的是 Perl 融合了 unix shell script 的使用惯例,以双引号 ("")括起来的字串会先经过展开,但反斜线(\)后面的字元则不展开,当作一般 字元看待。 而以单引号('')括起来的字串完全不会展开,以反单引号(``)括起 来的字串会把它当作命令列指令一样执行,等于system()一样。 初学者常常会 搞混,但习惯之后就会觉得不这样分清楚反而不行哩。举个例吧: $x="ls -l"; print "$x"; # Output ls -l print "\$x"; # Output $x print '$x'; # Output $x print `$x`; # Output files in this directory (5) Regular Expressions Regular Expression通常是用来寻找特定的字串样式(pattern),也就是所谓格 式辨认(pattern-matching)的功能。 它的运算子是『=~』和『!~』,可以把它念 做 match 和 not match。 Syntax: $string =~ /regular expression/expression modifier 例:$sentence =~ /Hello/ (a) Modifiers:修饰选项可有可无,它是用来对整个叙述作修正的。 g Match globally, i.e. find all occurrences. i Makes the search case-insensitive. m If the string has new-line characters embedded within it, the metacharacters ^ and $ will not work correctly. This modifier tells Perl to treat this line as a multiple line. o Only compile pattern once. s The character . matches any character except a new line. This modifier treats this line as a single line, which allows . to match a new-line character. x Allows white space in the expression. (b) Metacharacter:下面这些字元都具有特殊意义,可以让你建立更复杂的 搜寻样式(searching pattern)。 \ Tells Perl to accept the following characters as a regular character; this removes special meanings from any metacharacter. ^ Matches the beginning of the string, unless /m is used. . Matches any character except a new line character, unless /sis used. $ Matches the end of the string, unless /m is used. | Expresses alternation. This means the expressions will searchfor multiple patterns in the same string. ( ) Groups expressions to assist in alternation and backreferencing. [ ] Looks for a set of characters. (c) Pattern Quantifier:用来表示字元的数量关系。 * Matchs 0 or more times. + Matchs 1 or more times. ? Matchs 0 or 1 times. {n} Matches exactly n times. {n,} Matches at least n times. {n,m} Matches at least n times but no more than m times. (d) Character Patterns:下列的sequence用来match一些特定格式的字元: \r Carriage return(CR), ASCII 13(十进位) \n New line, UNIX 中代表 ASCII 10(十进位), DOS(Windows)系统中则是ASCII 13 + ASCII 10(十进位). \t Tab, ASCII 9(十进位) \w Matches an alphanumeric character. Alphanumeric also includes_. 即 [A-Za-z0-9_]. \W Matches a nonalphanumeric character. 即 [^A-Za-z0-9_]. \s Matches a white space character. This includes space, tab,FormFeed and CR/LF. 即 [\ \t\f\r\n]. \S Matches a non-whote space character. 即 [^\ \t\f\r\n]. \d Matches a digit. 即 [0-9]. \D Matches a nondigit character. 即 [^0-9]. \b Matches a word boundary. \B Matches a nonword boundary. \033 octal char \x1B hex char (e) Examples:Regular Expression 这个东东非常强大、非常重要,但是对 初学者来说简直是个恶梦,记得我当初刚接触时也是雾煞煞的,就算现在的我也 不敢说全懂了:p 但你若了解了它的基本技巧后,包你爱不释手,每每为它强大 的功能赞叹。上面那些表格相信你也是有看没有懂,这种东西要借由范例入门比 较快,下面我列出一些基本范例,希望能帮助你了解它的基本技巧。 /abc/ 找到含有 abc 的字串/^abc/找到开头是 abc 的字串/abc$/找到结尾是 abc 的字串/a|b/找到有 a或 b的字串,也可以用来找整个字(word) /ab{2,4}c/找到 a后面跟着2-4 个b,再跟着 c的字串,若只有/ab{2,}c/则 会找二个以上的 b/ab*c/找到 a后面跟着 0个或多个 b,再跟着 c的字串,如 同/ab{0,}c//ab+c/找到 a后面跟着一个以上的 b,再跟着 c的字串,如同/ ab{1,}c//a.c/.可以代表任何字元,除了new line字元(\n)外。/[abc]/找 到含有这三个字元中任何一个的字串/\d/找到含有数字的字串,如同/ [0-9]//\w/找到含有字母的字串,如同/[a-zA-Z0-9_]//\s/找到含有 white space 的字串,如同/[ \t\r\n\f]//[^abc]/找到没有 abc 任一字元的字串/ \*/找到含有字元*的字串,在反斜线"\"后面的字元 Perl 会把它当作普通字元 看待。若你不确定这个符号是否为特殊字元,干脆全加上\以策安全。/ abc/i忽略 abc 的大小写/(\d+)\.(\d+)\.(\d+)\.(\d+)/找到类似 IP 的字串,并将 IP 的四个数字分别存在$1,$2,$3,$4 四个特殊变数中,以便在 其后加以利用。例: if ($x =~ /(\d+\.\d+)\.\d+\.\d+/) { print "海洋大学" if ($1 eq "140.121"); } m//gimosxm 命令可以让你自订 pattern 的分隔符号,而 gimosx 则是它的修 饰选项,请参看(a)Modifiers。例如: $url="my.machine.tw:8080/cgi-bin/test.pl"; ($host, $port, $file)=($url=~m|http://([^/:]+):{0,1}(\d*)(\S*)$|); 这个Regular Expression相当复杂,主要目的是 分析 定性数据统计分析pdf销售业绩分析模板建筑结构震害分析销售进度分析表京东商城竞争战略分析 指定的URL,然后取得host 名称、port 号码及对应的档案。我一项项慢慢解释: $url=~m|| m 后面跟着的就是分隔符号,| |里面的就是 pattern。 ([^/:]+) match 一个字串,里面没有/和:字元。找到的字串存在$1 中。 :{0,1}(\d*) match 0 或 1 个:,后面跟着一串数字或 nothing。找到的字串存在$2 中,若找 不到,$2 就是空的。 (\S*)$ match 一串非空白字元,并以找到的字串为结尾。找到的字串存在$3 中。 ()=() ($host, $port, $file)=($1, $2, $3) 即$host="my.machine.tw" $port=8080 $file="/cgi-bin/test.pl" s/PATTERN/REPLACEMENT/egimox没错,这就是取代的命令。它会寻 找符合PATTERN的字串,并取代成REPLACEMENT字串。它的修饰选项多了 e选项, 其他的和上面都一样,我将它列表如下: e Evaluate the right side as an expression. g Replace globally, i.e. all occurrences. i Do case-insensitive pattern matching. m Treat string as multiple lines. o Only compile pattern once. s Treat string as single line. x Use extended regular expressions. 例: $x =~ s/\s+//g 把所有的 white space 全部去除掉 $x =~ s/([^ ]*):*([^ ]*)/$2:$1/ 把用":"分开的两个栏位互相对调 $path =~ s|/usr/bin|/usr/local/bin| 它也可以让你自订分隔符号哦 tr/SEARCHLIST/REPLACEMENTLIST/cds 这是也是取代的命令,和上一个不同的是 SEARCHLIST 和 REPLACEMENTLIST 只能 是普通字串,而不是 Regular Expression,所以速度比较快。它的修饰选项也 比较少: c Complement the SEARCHLIST. d Delete found but unreplaced characters. s Squash duplicate replaced characters. 例: $x =~ tr/this/that/ 把"this"替换成"that" $x =~ tr/a-z/A-Z/ 把小写字母全部替换成大写字母 $count = $x =~ tr/*/*/ 计算$x 中有几个"*" (6) Spectial Variables Perl的特色之一就是有超过50个以上的特殊变数,这些变数都是全域变数,用 来设定程式的执行环境和其它细节。 若你想深入了解Perl程式 设计 领导形象设计圆作业设计ao工艺污水处理厂设计附属工程施工组织设计清扫机器人结构设计 ,那么这些 东西是不可或缺的。在这里我只列几个常用的特殊变数以供参考,有兴趣的人请 自行查阅。 $_ The default input and pattern-searching space. $digit Contains the subpattern from a successful parenthesespattern match. $. The current input line number of last filehandle read. $! Contains the current value of errno. $0 The name of the file of the Perl script. @ARGV The command line arguments issued when the script wasstarted. @_ The parameter array for subroutines. %ENV This associative array contains your current environment. (7) Help 目前市面上有关 Perl 语言的 关于书的成语关于读书的排比句社区图书漂流公约怎么写关于读书的小报汉书pdf 并不多,就算是原文书也只有那几本圣经本。不 过只要是有关 CGI 的书,其内容大都会提到 Perl,但却很少教到基本语法,常 常使人一头雾水。 所以我建议:如果你真的想学好 Perl 语言,真得想拿 Perl 来写程式,那我建议你最好去买一本书来看,在观念上会比较清楚,在实际应用 上也会比较有帮助; 如果你只是想写一些简单的 CGI 程式,或只想看得懂别人 所写的 CGI 程式,那在网路上的资料就绰绰有余了。 首先你可以到各大BBS站的WWW板或program板的精华区找找,不过资料不会很 多,而且有点杂乱。 再不然你可以到蕃薯藤输入perl或cgi关键字找找,有不 少人的 homepage 上有教人如何用 Perl 写 CGI 程式,还有一堆别人已经写好的 CGI 程式可以抓来用用。 说到这里顺便打一下广告,在 http: //ind.ntou.edu.tw/documents 下有 Perl 的说明文件,做得相当不错,不过全 是英文的就是了,而我这份讲义打好后也会放在 IND 的 homepage 上,大家可以 抓回去参考参考。 第三种资源就是 Perl 本身的 man pages,你在 IND 帐号下键入 man perl 就可 以查阅了,这份文件做得不错,还根据Perl的各个部分写了man pages,如Perl syntax, builtin function, regular expression, data structure等, 大家 可以用man指令一一查询,有时候在写程式时一时忘了某个函数怎么用,这倒是 个方便又快速的查询方法。我会把这些 man pages 转成 html 格式,放在 WWW 上 让大家参考。
本文档为【perl基本语法】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_388858
暂无简介~
格式:pdf
大小:255KB
软件:PDF阅读器
页数:0
分类:互联网
上传时间:2011-11-25
浏览量:9