Time of Update: 2014-08-15
標籤:des blog http 使用 os 檔案 資料 for 本文轉載自:http://blog.csdn.net/like_zhz/article/details/5441946######################
Time of Update: 2014-09-15
標籤:blog io os 使用 java ar for 資料 div Perl“膠水”,能夠將各種應用程式或者各種語言的代碼結合起來。Perl可以編寫普通的指令碼程式,
Time of Update: 2014-09-01
標籤:perl sql dbconnect split url 1)url 判斷是否合法: /^(http:\/\/|https:\/\/)?((?:[A-Za-z0-9]+-[A-Za-z0-9]+|[A-Za-z0-9]+)\.)+([A-Za-z0-9]+)[\/\?\
Time of Update: 2014-08-22
標籤:style color 使用 os 檔案 ar line new size Perl class is a Perl package
Time of Update: 2014-08-17
標籤:perl1、unless控制結構條件為假時執行,與if相反可以附帶else2、Until控制結構條件為假時執行,一直執行到條件為真;3、條件修飾詞效果等同於:類似的模式:4、裸塊控制結構{ body;body;....}有利於為臨時變數圈定有效範圍5、elsif子句6、自增、自減同c語言7、for 用法同c語言8、for與foreach在perl中,兩者等價,優先選擇純正的foreach9、5種迴圈塊:for、foreach、while、until、裸塊last
Time of Update: 2014-08-10
標籤:perl在處理文本時,常常遇到這樣的情況:就是我們需要把兩行文本做一個比較,然後選擇性輸出。而在while(<FILEHAND>){do something}程式塊中預設只能一次讀取一行。筆者在這裡,舉一個簡單的例子來說明怎麼處理這種情況。有一個這樣一段文本:a 1 2 3 4a 5 6 7 8a 6 7 8 9a 7 8 9 11a 7 8 9 12a 13 12 14 15a 18 14 16 17a 2 3 4
Time of Update: 2014-08-03
標籤:perl最近在實習,看著公司有些指令碼是perl寫,久聞perl處理文本還是很強大的,趁著周末掃了一般這本書~記錄下了~undef 預設未定義字元,perl裡面沒有NULL,defined($x)函數:如果參數為undef返回falseqw(cs phy geo) 類似於 (“cs”, "phy",
Time of Update: 2018-12-08
1、time函數:返回從1970年1月1日起累計的秒數 使用:my $t=time(); 2、 localtime函數:擷取本地時區時間 使用:my $t=localtime(time()); 3、gmtime函數: 擷取格林威治時間 使用:my $t=gmtime(time()); 得到格式化時間(以localtime函數為例): my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time());
Time of Update: 2018-12-08
perl數組中正常的下標運算,想必大家都比較熟悉,這裡不作說明。本文想說的是perl數組下標的多數字取值,可以極大的方便數組的操作。注意:這些數字是從0 到 $#array的。子數組複製代碼 代碼如下:@array = (1, 2, 3, 4, 5);@subarray = @array[0,1]; # @subarray = (1, 2)@subarray2 = @array[1..3]; # @subarray2 = (2,3,4)@array[0,1] = ("string", 46);
Time of Update: 2018-12-08
該模組用perl的數組代表一個檔案,檔案的每一行對應數組的一個元素,第一行為元素0,第二回為1,... 檔案本身實際並不載入到記憶體,對數組元素的操作立刻作用到檔案裡。最大的方便是可以任意指定處理開頭結尾的某幾行。基本用法:複製代碼 代碼如下:use Tie::File;tie @array, 'Tie::File', filename or die ...;$array[13] = 'blah'; # line 13 of the file is now 'blah'print
Time of Update: 2018-12-08
1.Perl將一般的變數成為標量,該變數可以指代的直接量包括兩種:數字直接量;字串直接量。a) 字串的表示方法:單引號,單引號中的字串中的含義直觀,不需要求變數值和逸出字元;雙引號,需要求變數值和逸出字元值。如果需要消除,通常需要在前面添加反斜線,其中的單引號或雙引號也需要。b) 此外,可以使用qq或q分別代替雙引號或單引號,界限符可以用成對的(), <>, {}, []等。2.
Time of Update: 2018-12-08
用Open() 函數開啟檔案開啟檔案的常用方法是:複製代碼 代碼如下:open(FH, "< $filename") or die "Couldn't open $filename for reading: $!"; open()
Time of Update: 2018-12-08
Perl的特殊符號@ 數組 $x{} x名字前面是貨幣符號($),後面是花括弧({}),則其為 hash 元素% 要引用整個 hash,使用百分比符號(“ )作為首碼。前面幾頁中使用的 hash 的名字為%family_name。$! 系統產生的一些可讀的資訊,也可能是出錯的資訊$_ 子函數參數變數自己本身@_ 子程式的私人變數&x 調用子函數x<>
Time of Update: 2018-12-08
在networking方面,最基礎的是BSD socket編程,但往往perl入門時在這個方面,最頭疼的無疑是如何開始,如何Step by step。最好的藥方就是Example,一段完整的可以運行(working)的代碼,通過實踐來感受遠比看枯燥的manual來得深刻。
Time of Update: 2018-12-08
1. 用grep函數 函數名 grep 調用文法 @foundlist = grep (pattern, @searchlist); 解說 與同名的UNIX尋找工具類似,grep函數在列表中抽取與指定模式比對的元素,參數pattern為欲尋找的模式,傳回值是匹配元素的列表。 例子 @list = ("This", "is", "a", "test"); @foundlist = grep(/^[tT]/, @list); 結果 @foundlist = ("This", "test"); 2.
Time of Update: 2018-12-08
1,定界符 =~ m/there/; =~ s/there/here/; 還有類型的定界符: =~ /there/ =~ m#there#; =~ s#there#here#; =~ m(there); =~ s(there)(here); =~ m{there}; =~ s{there}{here}; =~ m[there]; =~ s[there][here]; =~ m,there,; =~ s,there,here,; =~ m.there.; =~ s.there.here.; =~
Time of Update: 2018-12-08
1 line perl 今天來說說perl,只有一行的perl程式。 各種程式設計語言中perl是以變態的古靈精怪而聞名的,比如我,就經常寫出自己都看不懂的perl程式來。 比如這篇文檔中的程式,雖然短小,估計一個星期之後我看這就要頭暈了。但這絲毫不影響perl作為 一個功能強大的系統管理工具和系統控制語言的存在和推廣,而且靈活性恰恰是它最大的優勢,你可以 這樣寫,也可以那樣寫,“或者,絕招同途異路。” 1. hello world! ==============================
Time of Update: 2018-12-08
反向串連代碼: 1. #!/usr/bin/perl 2. #usage: 3. #nc -vv -l -p PORT(default 1988) on your local system first,then 4. #Perl $0 Remote IP(default 127.0.0.1) Remote_port(default 1988) 5. #Type 'exit' to exit or press Enter to gain shell when u under
Time of Update: 2018-12-08
一、定義 子程式即執行一個特殊任務的一段分離的代碼,它可以使減少重複代碼且使程式易讀。PERL中,子程式可以出現在程式的任何地方。定義方法為: sub subroutine{ statements; } 二、調用 調用方法如下: 1、用&調用 &subname; ... sub subname{ ... } 2、先定義後調用 ,可以省略&符號 sub subname{ ... } ...
Time of Update: 2014-06-04
1.perl中~~為智能匹配,它可以智能地根據符號兩側的運算元來確定操作。如要判斷某個元素是否存在於數組中,不使用智能匹配,程式像這樣:my $x=2;my @array=(1,2,3);my $flag=0;for (@array){if($x==$_){$flag=1;}}if($flag == 1){print "$x is in the array";}else{print "$x is not in the