Time of Update: 2015-01-30
標籤:#!perluse warnings;use strict;use Net::SMTP_auth;#&sendMail;while(1){my ($sumMem, $freeMem, $rateMem);open MEM, "cat /proc/meminfo |" or die $!;while(<MEM>){$sumMem = $1 if(/MemTotal:\s+(\d+)\s+kB/);$freeMem += $1 if(/MemFree:\
Time of Update: 2014-07-23
標籤:style http for re 問題 c Win8.1(專業版)下執行Perl(版本5.18.2)的PPM工具提示:C:\Users\寧>ppmppm gui failed: DBI connect(‘dbname=C:\Users\寧\AppData\
Time of Update: 2015-05-09
標籤: #!/usr/bin/perl#get scripts name#print $0 . "\n";#get the parametersmy $argc = $#ARGV+1;my $src_file;my $dst_file;#print "$argc\n";if($argc == 2) { $src_file = @ARGV[0]; $dst_file = @ARGV[1];} elsif ($argc == 1) { $src_file = @ARGV[
Time of Update: 2015-04-24
標籤:perl 用法 變數類型 Perl的變數類型及用法Variable types and their uses| Type | Sigil | Example | Is a&nb
Time of Update: 2015-04-23
標籤:perlRegex:Regex在perl叫模式,是一個匹配某字串的模板。perl的Regex和shell/awk/sed/grep的差不多。 m/pattern/
Time of Update: 2015-03-19
標籤:1?? ? 由於在新版本中GCC把C99中的標準庫分成了libc和libm兩個部分,libm中包含一些數學庫等,如果要用到libm時,必須加上-lm選項在解壓Configure之後,再在Makefile中,LDFLAGS 和 CLDFLAGS兩個參數後面加上 -lm即可解決問題2?? ? 參考:http://serverfault.com/questions/145288/make-error-when-compiling-perl-5-12-1-rhel-5-5? ? ?修改 dist/
Time of Update: 2015-03-19
標籤:在perl中,調用系統命令有兩種形勢,`cmd` 和system"cmd",他們主要的區別是`cmd`會擷取返回結果,而system"cmd"會直接將結果輸出到螢幕上,針對這個區別有以下兩種用法:1,當需要擷取運行結果的時候,如擷取目前的目錄,就應該寫成 chomp($pwd = `pwd`);如果寫成 $pwd = system"pwd",則$pwd值為0。(這裡用到chomp說明`cmd`的結果是包含分行符號的,使用時需要注意)。2,當需要讓一些命令後台運行時,則應該使用system"
Time of Update: 2015-01-24
標籤:本文和大家重點討論一下Perl split函數的用法,Perl中的一個非常有用的函數是Perl split函數-把字串進行分割並把分割後的結果放入數組中。這個Perl split函數使用規則運算式(RE),如果未特定則工作在$_變數上。Perl split函數Perl中的一個非常有用的函數是Perl split函數-把字串進行分割並把分割後的結果放入數組中。這個Perl split函數使用規則運算式(RE),如果未特定則工作在$_變數上。Perl split函數可以這樣使用:$info="
Time of Update: 2015-01-21
標籤: Hi everyone. Today I will start a new series of esssays introducing the elementary knowledge of Perl, a computer language of which probably many of us never heard. I‘ll try my best to articulate my idea. If there is something you
Time of Update: 2015-01-17
標籤:1. 數組#!/usr/bin/perlmy $str = "hello,nihao,no,o,good";my @arr = split(/,/, $str);print "len:" . @arr . "\n";for (my $i=0; $i < @arr; $i++){ #括弧必須有 print @arr[$i] . "\n";} #!/usr/bin/perl@ifs=qw(eth1 eth2.45 eth3);$it=grep /eth2$/, @ifs;
Time of Update: 2015-01-11
標籤:Perl的here文檔機制是從UNIX shell中的here文檔機制派生而來的。和在shell中一樣,Perl中的here文檔也是面向行的參考資料表單,要求提供<<運算子,其後跟隨一個初始的終止字串。<<之後可以不出現空格。如果終止字串沒有加上引號或雙引號,則允許執行Variant 運算式。如果終止字串上加了單引號,則不執行Variant
Time of Update: 2014-12-04
標籤:io os 使用 sp for on bs ef amp 大家用過unix或者linux系統,對vi,sed,gre
Time of Update: 2015-05-07
標籤:在Perl中可以自己建立子程式(Subroutine):關鍵字sub,子程式名以及用花括弧封閉起來的代碼塊。 sub marine { ...
Time of Update: 2014-10-01
標籤:style blog color io os 使用 ar 檔案 資料 這裡歸納一下用perl語言編程需要注意的問題。1.
Time of Update: 2014-08-26
標籤:os 使用 檔案 ar 2014 line sp new on #!/usr/bin/perl# file : DATA.pl# author : darkstar# date
Time of Update: 2014-08-20
標籤:style blog http os 檔案 2014 cti log 1、改變目錄chdir "/etc" or die "can‘t chdir to
Time of Update: 2014-08-15
標籤:perl Regex 1、替換s/PATTERN/REPLACE/;#返回是否替換成功的布爾值可以使用捕獲變數,如:s/(\w)/$1/匹配失敗則不做任何處理2、定界符對於沒有左右之分的定界符,重複三次即可,如:s///、s###對於有左右之分的定界符,需使用兩對,一對包含模式,一對包含替換字串,這兩對可以不一樣,如:s{}{}、s[]{}、s<>[]3、可選修飾符/g可進行全域替換,替換所有匹配
Time of Update: 2014-08-09
標籤:perl path hash 1、雜湊的鍵是唯一的,值可以重複!2、訪問雜湊元素$hashname{“$key”};#雜湊為大括弧,數組為方括弧,鍵為字串$family_name{"fred"} = "firstd";#給雜湊元素賦值3、雜湊鍵支援任意運算式$foo =
Time of Update: 2018-12-08
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 1994"2.如果要把時間儲存在資料庫中,可以先將其儲存為字串,然後讀出時對字串再處理。@nowtime=localtime();$nowstring=
Time of Update: 2018-12-08
一、開啟、關閉檔案 文法為open (filevar, filename),其中filevar為檔案控制代碼,或者說是程式中用來代表某檔案的代號,filename為檔案名稱,其路徑可為相對路徑,亦可為絕對路徑。 open(FILE1,"file1"); open(FILE1, "/u/jqpublic/file1"); 開啟檔案時必須決定訪問模式,在PERL中有三種訪問模式:讀、寫和添加。後兩種模式的區別在於寫入模式將原檔案覆蓋,原有內容丟失,形式為:open(outfile,