Time of Update: 2017-02-28
本章介紹如何使用Perl DBI 與MySQL介面。我們不討論DBI 的基本原理或體繫結構。有關DBI 這些方面的資訊(特別是與C 和PHP API 的比較),請參閱第5 章。 本章的舉例動用了範例資料庫samp_db,使用了學分儲存方案和曆史同盟需要的表。想要從本章中取得最大收穫,最好瞭解一些有關Perl
Time of Update: 2017-02-27
安裝Sybase ASEsybase-common-11.9.2-1.i386.rpmsybase-ase-11.9.2-1.i386.rpm安裝Sybase OpenClientsybase-openclient-11.1.1-1.i386.rpm來源:http://www.sybase.com/products/databaseservers/linux/thankyou1192.html方法:rpm -hiv sybase-common-11.9.2-1.i386.rpmrpm -hiv
Time of Update: 2017-02-27
Perl CGI 環境變數會因為伺服器的不同而有所區別。所以本內容不一定和你的WEB 伺服器相完全符合。以下的內容以字母排序:1. AUTH_TYPE如果伺服器支援基本的認證並且如果指令碼被保護,此變數提供認證類型,此資訊是特定於協議和伺服器的。2. CONTENT_LENGTH如果通過 POST 方法的請求中包括資料,此變數的值為此請求中合法資料的長度。3. CONTENT_TYPE如果請求中包括資料,此變數指定資料類型的類別。4. DOCUMENT_ROOT網路提供的檔案服務所在的路徑。5.
Time of Update: 2017-02-28
這篇文章主要介紹了Perl學習筆記之CPAN使用介紹,本文講解了什麼是CPAN、CPAN的目錄作用介紹、CPAN安裝Perl Module的兩種方法等內容,需要的朋友可以參考下 CPAN(Comprehensive Perl Archive Network:全面的Perl存檔網路)是尋找任何Perl有關的東西的中心倉庫。它包含從整個Perl社區收集來的智慧:成百上千的
Time of Update: 2018-07-20
使用了兩個不同的函數,在執行效率上checkmd5sum.pl 比checkmd5sum_find.pl要更快。 1.checkmd5sum.pl #!/usr/bin/perl # # File: checkmd5sum.pl # Author: amxku.net # Date: 2008-12- ...兩個使用了不同的函數,在執行效率上checkmd5sum.pl 比checkmd5sum_find.pl要更快。1.checkmd5sum.pl
Time of Update: 2018-07-20
轉自:http://perl.apache.org/docs/general/perl_reference/perl_reference.html use(), require(), do(), %INC and @INC Explained The @INC array @INC is a special Perl variable which is the equivalent of the
Time of Update: 2018-07-25
use base 是物件導向編程時,用來描述“基類”的,其實說白了,use base somemodule;就相當於以下兩句的結合:BEGIN{ use somemodule (); push @ISA, qw(somemodule);}也可以同時 use base 兩個或者兩個以上的模組,例如:use base qw(Foo Bar);就相當於:BEGIN { use Foo (); &
Time of Update: 2018-07-25
packge Mule;use base ("Horse", "donkey"); # 聲明一個超類它是下面東西的縮寫:package Mule;BEGIN {our @ISA = ("Horse", "Donkey");require Horse;require Donkey;}Horse 類 :[root@wx03 test]# cat Horse.pm package Horse;BEGIN {our
Time of Update: 2018-07-26
1.undef undef是perl中變數未初始化時的預設值。當這個未初始化的變數被當做整型來使用時,那麼undef就是0;當這個變數被當做字串來使用時,那麼undef就是Null 字元串。所以當在perl中使用一個未經過初始化的變數時,程式的運行是沒有問題的。 例如: $sum += 1; #該語句第一次被執行時,sum變數預設為0
Time of Update: 2017-01-18
主要是利用尋找/proc目錄下的相關檔案進行尋找.#!/usr/bin/perl use strict;use warnings;#usage: process_grep.pl ProcessNameexit( main(@ARGV) ); sub main { my $Phash; my $ProcessName = shift; my $PROC_DIR = "/proc"; chdir $PROC_DIR; my @pids = glob "[0-9]*"; for my
Time of Update: 2017-01-18
一、開啟、關閉檔案 open的傳回值用來確定開啟檔案的操作是否成功,當其成功時返回非零值,失敗時返回零,因此可以如下判斷: if (open(MYFILE, "myfile")) { # here is what to do if the file opened
Time of Update: 2017-01-18
例子:複製代碼 代碼如下:#!/bin/perlprint "Please input an string and a number by order!\n"; $the_string=<>; $the_numb=<>; print "The result is \n"; print "$the_string"x"$the_numb"; 結果:The result is my
Time of Update: 2017-01-18
例1:複製代碼 代碼如下:#!/usr/bin/perluse strict; use warnings;my $test = "asdf";print "${test}_test2\n";#constantuse constant { AAA => "aaa", BBB=> "bbb", MIN_TOTAL => 12, SCORE_
Time of Update: 2017-01-18
1. 一般使用:@nowtime=localtime();#($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();注意:$mon+1,$year+1900;$now_string = localtime; # e.g., "Thu Oct 13 04:54:34
Time of Update: 2017-01-18
基本用法#初始化%h為空白數組 %h={};#用數組初始化%h為a=>1,b=>2 %h=('a',1,'b',2);#意義同上,只是另一種更形象化的寫法。%h=('a'=>1,'b'=>2);#如果key是字串,可以省略引號。下面這行和上面那行是一樣的%h=(a=>1,b=>2);#用{}來訪問print “$h{a}\n”;#列印 $h{b}='2b'; print “$h{b}\n”;
Time of Update: 2017-01-18
來看看下面的代碼會輸出什嗎?複製代碼 代碼如下:my $a = 0;$a = $a or 1;print $a, "\n";$a = $a || 1;print $a, "\n";輸出:01為什麼呢?因為||, =, or 這三者優先順序從左至右逐漸降低。所以,這樣寫可以:chomp(my $filename = shift( @ARGV ) || <STDIN>);這樣則不行:chomp(my $filename = shift( @ARGV ) or <STDIN>)
Time of Update: 2017-01-19
首先來看看 POSIX 風格Regex的兩個主要函數: ereg 函數:(Regex匹配) 格式:int ereg ( string pattern, string string [, array ®s] ) 注意:使用 Perl 相容Regex文法的 preg_match() 函數通常是比 ereg() 更快的替代方案。(一般的話還是使用 preg_match() ,比較好勒~~) 以區分大小寫方式在 string 中尋找與給定的Regex pattern 所匹配的子串。如果找到與
Time of Update: 2017-01-19
複製代碼 代碼如下:APR_DECLARE_NONSTD(unsigned int) apr_hashfunc_default(const char
Time of Update: 2018-07-26
#!/usr/bin/perl -wuse strict;use Net::SMTP;use Authen::SASL;(在SMTP伺服器上要求使用者認證,必須的模組)BEGIN {push (@INC,'/usr/lib/perl5/5.8.8/Net/ '); } my $from = 'huashan125@huashan.peonymao.com';my $to = 'peonymao@orrisintl.com';my $username = 'huashan125';my $
Time of Update: 2018-07-26
用到memcached,記下 memcached中儲存的資料都儲存在memcached內建的記憶體儲存空間中。 由於資料僅存在於記憶體中,因此重啟memcached、重啟作業系統會導致全部資料消失。 另外,內容容量達到指定值之後,就基於LRU(Least Recently Used)演算法自動刪除不使用的緩衝。 memcached本身是為緩衝而設計的伺服器,因此並沒有過多考慮資料的永久性問題。 memcached是“分布式”快取服務器,但伺服器端並沒有分布式功能。