1、按一下以編輯母片標題樣式,按一下以編輯母片文字樣式,第二層,第三層,第四層,第五層,*,*,本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考,不能作为科学依据。本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考!,按一下以編輯母片標題樣式,按一下以編輯母片,第二層,第三層,第四層,第五層,*,生物資訊程式語言應用,本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考,不能作为科学依据。本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考!,按一下以編輯母片標題樣式,按一下以編輯母片文字樣式,第二層,第三層,第四層,第五層,*,*,本资料仅供参考,不能作为科学依据。谢谢。本资料仅供
2、参考,不能作为科学依据。本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考!,按一下以編輯母片標題樣式,按一下以編輯母片文字樣式,第二層,第三層,第四層,第五層,*,*,本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考,不能作为科学依据。本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考!,按一下以編輯母片標題樣式,按一下以編輯母片文字樣式,第二層,第三層,第四層,第五層,*,*,本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考,不能作为科学依据。本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考!,按一下以編輯母片標題樣式,按一下以編輯母片文字樣式,第二層,第三層,第
3、四層,第五層,*,*,本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考,不能作为科学依据。本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考!,按一下以編輯母片標題樣式,按一下以編輯母片文字樣式,第二層,第三層,第四層,第五層,*,*,本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考,不能作为科学依据。本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考!,按一下以編輯母片標題樣式,按一下以編輯母片文字樣式,第二層,第三層,第四層,第五層,*,*,本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考,不能作为科学依据。本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考!
4、按一下以編輯母片標題樣式,按一下以編輯母片文字樣式,第二層,第三層,第四層,第五層,*,*,本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考,不能作为科学依据。本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考!,按一下以編輯母片標題樣式,按一下以編輯母片,第二層,第三層,第四層,第五層,*,本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考,不能作为科学依据。本资料仅供参考,不能作为科学依据。谢谢。本资料仅供参考!,生物資訊程式語言應用,Part 3,Perl,Language,1/26,Outline,Introduction.,Installation.,Backgrou
5、nd knowledge in Perl.,Data type.,Control structure.,Regular expression.,Overall practice.,2/26,Introduction,Perl is free software.,Larry Wall(He is a linguist).,The history of Perl language.,1987-Perl 1.0.,1994-Perl 5(contain OOP).,OOP(object oriented programming),物件導向程式語言,Perl 5.8.0 support unicode
6、Perl 6.,Now.,Characteristic.,The script language base on C language(,具跨平台特征,).,3/26,Installation,Perl is the default language in any distribution of Linux.,Perl can be executed and worked by the ActivePerl package in windows platform.,to edit Perl program?,Notepad in windows,UltraEdit and any text
7、 editor.,4/26,Installation,cont.,Practice.,Download ActivePerl software file.,Install ActivePerl.,5/26,Background knowledge,Data type in Perl.,Control structure in Perl.,Regular expression in Perl.,6/26,Data type in Perl,Like English,Scalar(,純量變數,),比喻單件事物,.,數字常數,$x=5;,字串常數,$y=“Hello”;,The special ex
8、pression of Perl.,Print“Hello”.”World”;(Hello World).,Print“Hello”*2;(HelloHello).,字串與數字間轉換,$x=123;$y=“456”;,Print$x+$y;(,數字,),Print$x.$y;,(,字串,),7/26,Data type in Perl,cont.,Practice.,Using scalar.,Special expression.,字串與數字間轉換,.,8/26,Data type in Perl,cont.,Array(,陣列,).,The definition of Array in P
9、erl.,student=(9154610,9154611,”9154612”);,my student;,$student0=9154610“;$student1=“9154611“;$student2=“9154611”;,Array,單數取用,.,print$student0,n;,print$student1n;,print$student2.n;,Array,複數取用,.,print student,“n”;(,全部一起,print,出來,),以單數取用方式,print,出複數資料,(in control structure chapter).,9/26,Data type in P
10、erl,cont.,Practice.,Using array(definition).,單數取用,.,複數取用,.,10/26,Data type in Perl,cont.,Hash(,雜湊,).,$,純量,=,單一,=,單數,陣列,=,串列,=,複數,%,雜湊,=,串列,=,複數,定義陣列,=,類似,ip,student=(9154610,9154611,”9154612”);,定義雜湊,=,類似,dns,%students=(Peter=9154610,Mary=9154611,Cathy=9154612);,11/26,Data type in Perl,cont.,Hash(,雜湊
11、).,定義雜湊,=,類似,dns,%students=(Peter=9154610,Mary=9154611,Cathy=9154612);,Hash,單數取用,.,print$studentsPeter,n;,print$studentsMary,n;,print$studentsCathy,n;,Hash,複數取用,.,print%students,n;,以單數取用方式,print,出複數資料,(in control structure chapter).,12/26,Data type in Perl,cont.,Practice.,Using hash(definition).,單數
12、取用,.,複數取用,.,13/26,Control structure in Perl,If statement(,陳述式,).,For loop(,迴圏,).,Foreach loop(,迴圏,).,While loop(,迴圏,).,14/26,Control structure in Perl,cont.,If,條件判斷,If,條件成立則執行,若,If,條件不成立則執行,(else statement,可有可無,),If statement(,陳述式,).,15/26,Control structure in Perl,cont.,Practice.,If statement.,If-e
13、lse statement.,16/26,Control structure in Perl,cont.,For loop(,迴圏,).,$#array:,取得,array,大小,$i+:,等同於,$i=$i+1;,$sum+=$i:,等同於,$sum=$sum+$i;,17/26,Control structure in Perl,cont.,Practice.,For loop,迴圏,.,以,array,單數取用方式,print,出,array,複數資料,.,以,hash,單數取用方式,print,出,hash,複數資料,.,18/26,Control structure in Perl,
14、cont.,Foreach loop(,迴圏,).,Like for loop.,For loop,Foreach loop,19/26,Control structure in Perl,cont.,Practice.,Foreach loop(,迴圏,).,以,array,單數取用方式,print,出,array,複數資料,.,以,hash,單數取用方式,print,出,hash,複數資料,.,20/26,Control structure in Perl,cont.,While loop(,迴圏,).,While,判斷式,21/26,Control structure in Perl,c
15、ont.,Practice.,While loop(,迴圏,).,1+2+100.,22/26,Regular expression in Perl,樣式,(pattern),表達,.,繫結符號,=.,=,可用來將右邊樣式比對左邊字串純量,成功傳回,1,,失敗傳回,0.,表否定則可改用,!,通常搭配判斷式使用,.,23/26,Regular expression in Perl,cont.,比對,.,$:,代表字串中比對成功之前部分,.,$&:,代表字串中比對成功部分,.,$:,代表字串中比對成功之後部分,.,24/26,Regular expression in Perl,cont.,字元取代,.,$var=tr/xxx/yyy/,把變數,$var,內,xxx,字元都逐一代換成,yyy,字元,字串取代,.,$var=s/xxx/yyy/,把變數,$var,內第一個,xxx,子字串整個代換成,yyy,子字串,$var=s/xxx/yyy/ig,I:,忽略大小寫,g:,取代,$var,字串內全部符合子字串,25/26,Regular expression in Perl,cont.,Practice.,比對,.,字元取代,.,字串取代,.,26/26,






