Time of Update: 2018-07-26
轉自: http://bbs.chinaunix.net/thread-1191868-1-1.html#
Time of Update: 2018-07-26
Perl Debug [From] http://goldenink.com/perl/perldebug.html The concepts of the perl debug are familiar to most programmers. Trace, breakpoint, and conditional breakpoint (watchpoint) are effective means with which to find problems in your perl
Time of Update: 2018-07-26
一、安裝perl [root@centos ~]# wget http://www.cpan.org/src/5.0/perl-5.16.0.tar.gz [root@centos ~]# tar zxvf perl-5.16.0.tar.gz [root@centos ~]# cd perl-5.16.0 [root@centos perl-5.16.0]# mkdir -p /usr/local/perl [root@centos perl-5.16.
Time of Update: 2018-07-29
在文本處理時經常會碰到這樣的情況:有一批檔案需要修改裡面的內容,但是又希望保留原來檔案的內容。這個時候Perl提供了一個很方便的變數$^I,將需要備份檔案的尾碼儲存在該變數後,我們在修改檔案內容時,Perl會: 1、先將原檔案開啟並另存新檔以“原檔案名稱+$^I存放的尾碼字元”為檔案名稱的備份檔案。 2、在原檔案上修改。 例如下面一段程式,我要將所有.dat文本中的abc改為dfg,並備份成.bak的檔案
Time of Update: 2018-12-03
1. 數組名可以和標量名相同 //不怕自己昏頭就用吧=.=2. 數組越界僅僅只是值為undef3. 底線僅僅起將長數字劃分的作用4. 數組最後一個元素的索引值為$#array5. 嗷~~支援負索引值! 比如,3個元素的數組,-1索引為第三個,-2為中間的,-3為第一個6. 負索引越界會產生嚴重錯誤..=.= fatal error!7. 列表, .. 是範圍操作符(range operator),比如(1..100),表示1到100,整數列表8. ..
Time of Update: 2018-12-03
1. 子程式(入鄉隨俗?),調用的時候以&開頭,以區別於$和@2. 子程式塊中的標量,不做修飾,將是全域的,一個檔案中多次調用該子程式,將能多次修改該標量3. 子程式中最後一步計算的運算式的值將會作為傳回值...(真TM是個懶人)4. 子程式的參數列表居然是調用的時候才給出!!!儲存在@_中5. 子程式中使用my語句建立私人變數,比如 sub max{ my($m,$n)= @_; $m>$n?$m:$n;}6. 不能在同一範圍中重複定義變數7.
Time of Update: 2018-12-03
perl教程http://www.cbi.pku.edu.cn/chinese/documents/perl/index.htmperl入門http://developer.51cto.com/art/201009/224638.htm學習perl一 helloworld**********************************************簡單介紹:Perl是一種指令碼語言.追求的是簡單, 解決一個一般的問題用它幾行代碼就完成了. 一個稍複雜一點的問題代碼也不會超過一屏!
Time of Update: 2018-12-03
1、$position = index(string,substring,skipchars); 該函數返回子串substring在字串string中的位置,如果不存在,則返回-1;參數skipchars是選擇性參數,表示尋找之前跳過的字元數,即:從該位置處開始尋找;2、rindex(string,substring,skipchars):功能與index()類似,不同的是它從string的右端開始尋找;3、$Len = length(string):求字串的長度;4 、
Time of Update: 2018-12-03
1、數字運算子:+(加) 、-(減)、 *(乘) 、/(除)、**(乘方/乘冪)、%(取餘); 這些運算子混合了整數、浮點數和實數運算,運算的結果都寸入了正確的數字上下文中; 複合賦值運算子: +=、-=、*=、/=、**=、%=、.=、&=、|=、^=、<<=、>>=、&&=、||=; 自增/自減運算子: ++/-- ++運算子除了可用於數字運算之外,還可以用於字串運算,而--運算子則只能用於數字運算中; 如:
Time of Update: 2018-12-03
一、參數中的數組和雜湊變數:在定義參數列表的時候,有兩種方法可以定義數組或雜湊變數為輸入參數:1、在數組或雜湊變數形參類型名前面加上反斜線“/”;2、把數組或雜湊變數形參類型名放在參數列表中最後面的位置上;作為參數傳遞的數組或雜湊變數都將會被複製到參數列表的標量變數列表中,產生個數不確定的參數列表;實際上標量變數和加反斜線“
Time of Update: 2018-12-03
轉載自:http://club.topsage.com/thread-464914-1-3.html關於學習PerlPerl是一門很有用的語言,可以用它來做很多事。然而,它也僅是一門語言,掌握了Perl,你只是掌握了Computer領域的一小塊知識。在學習Perl前,請明確你的學習目的,並採用正確的學習方法和資源。(一)學習目的你學Perl的目的是什嗎?要實現你的目的,光有Perl夠嗎?讓偶幫你分析看看。1. 我想當一名System
Time of Update: 2018-12-03
用到memcached,記下 memcached中儲存的資料都儲存在memcached內建的記憶體儲存空間中。由於資料僅存在於記憶體中,因此重啟memcached、重啟作業系統會導致全部資料消失。另外,內容容量達到指定值之後,就基於LRU(Least Recently
Time of Update: 2018-12-03
Notice a great post on reddit, the author listed some useful modules in it. I am excited for that Perl community always appears to be full of vitality and innovation that surprise us.Below content is referring to
Time of Update: 2018-12-03
# Recently, I experienced Notes crash problems several times. # It wasted me a lot of time to terminate Notes completely and then restart it, # so I wrote this Perl script to save myself. Also hope it's helpful to you when you read these comments #
Time of Update: 2018-12-03
$_這個特殊變數是許多Perl函數的預設參數,也是許多Perl控制結構的預設控制變數. $_特殊變數也可當作一個函數調用缺失的參數來使用.foreach 結構的控制變數是可選的,預設為$_的值.Perl把最近發生的系統錯誤訊息儲存在特殊變數$!中.#! /usr/local/bin/perl -W#fig05_03.plforeach $name('Amanda','Jeff','Sarah','David') { print "$name";}print
Time of Update: 2018-12-03
作為軟體開發人員,有時需要對伺服器上的某些進程進行監控,以便掌握伺服器的運行情況。因此當出現異常情況時,郵件提示是個不錯的選擇,可使開發維護人員及時進行維護處理。1:利用Mail::Sendmail發送普通郵件#!/usr/bin/perluse strict;use Mail::Sendmail;sendmail(From =>
Time of Update: 2018-12-03
sub checkMD5() { my ( $md5val,$scan_file) = @_; if ( $md5val !~ /[0-9a-f]{32}/i) { die "invalid md5 value./n"; } if( ! -e $scan_file ) { print "No updateX file exist. /n"; return -1 ;} print "/n<<<<<<<<<<&
Time of Update: 2018-12-04
系統裝了3個perl1,內建的perl 、/usr/bin/perl perl -v->5.8.82.裝機內建的公司perl /opt/VRTSperl/bin/perl 5.10.03.需要跑Devel::Cover 的程式 SORT 中帶的perl /sortdir/advance/perl/bin/perl 目前5.14.2 1.首先把5.14.2拷貝到 /usr/lib/perl 和 /opt/VRTSperl/lib/perl 中
Time of Update: 2018-12-04
#!/usr/bin/perluse strict;use warnings;use DBI;opendir (DIR,"dirpath/") ||die "can not open it";my @connect = readdir(DIR);closedir DIR;my $dir_need;foreach my $con (sort @connect){ if ($con =~ /-[0-9]{2}-[0-9]{2}_/){ $dir_need = $con; }
Time of Update: 2018-12-04
預覽◆ 語言的發展趨勢一定是動靜結合、剛柔並濟◆ Perl凝練晦澀,Python優雅明晰,Ruby精巧靈動,PHP簡明單純◆ 或許優雅正是來自對細節和規範的重視◆ (RoR)與Ruby結合之後,便如一隻猱身而上靈貓,立刻襯托出Java和.NET大象般的身影提問◆ Perl、Python、Ruby和PHP各自有何特點?◆ 為什麼動態語言多作為輕量級的解決方案?◆ LAMP為什麼受歡迎?◆ Ruby on Rails為什麼會流行?◆