Time of Update: 2018-12-04
很久沒發貼了,今天發個文章,專門介紹下LWP模組常用的功能。(1)最重要的一大功能是查看網頁源檔案,我們可以通過perl已有的方法查看網頁源檔案,然後可以進行適當的分析,得到自己想要的結果。perl指令碼如下: #!/usr/local/bin/perluse CGI qw(:all);use LWP;open (AIM,">F:/SFDA的原始碼") or die $!;my $browser = LWP::UserAgent->new; my $url =
Time of Update: 2018-12-04
有的時候我們會需要處理到檔案的一些屬性,比如說唯讀、隱藏之類的,我這裡大概說下在WIN32下如何取得和修改檔案的屬性。 需要: use Win32::File; 然後使用如下方法: my $set;#取得檔案的屬性 Win32::File::GetAttributes($name, $set);#設定檔案的屬性 Win32::File::SetAttributes($name, ARCHIVE);在perldoc裡,可供設定的屬性如下:ARCHIVE
Time of Update: 2018-12-04
翻 譯:fayland 出 處:中國 Perl 協會 FPC - PerlChina.org 原 名:Perl XML Quickstart: The Perl XML Interfaces 中 文:中文名稱 作 者:Kip Hampton 原 文:http://www.xml.com/pub/a/2001/04/18/perlxmlqstart1.html 發 表:2001-04-18 Perlchina 提醒您:請保護作者的著作權,維護作者勞動的結晶。 目錄 [隱藏]
Time of Update: 2018-12-05
文章目錄 MySciprt.pl(使用MyModule的一個例子) zz from http://fanqiang.chinaunix.net/program/perl/2005-06-28/3349.shtml 是否覺得perl中關於模組的文檔有些難懂?好的,這裡有一個世界上最簡單的模組,它將用於展示(demonstrate)Exporter模組所有的特性,另外還有一段使用這個模組的指令碼。同時,我們也會給出一個有關於@INC的簡短說明,
Time of Update: 2018-12-05
1.解析xml 用到兩個包: # use moduleuse XML::Simple;use Data::Dumper; 過程: # create object$xml = new XML::Simple;#解析$data = $xml->XMLin(xml檔案名稱);#取值my $value=$data->{節點名字}如果有子節點則為 my $value=$data->{節點名字}->{子節點名字}; 2.解析json 用到的perl包use JSON;use
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-05
用 Sysopen()進行更多的控制 -------------------------------------------------------------------------------- 為了更好的控制檔案的開啟檔案,可以使用 sysopen() 函數: use Fcntl; sysopen(FH, $filename, O_RDWR|O_CREAT, 0666) or die "Can't open $filename for reading/writing/creating :
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-05
中國移動遊戲頻道,遊戲玩家套餐包中的玩家樂園遊戲上線啦,很開心,作為開發人員之一,加了那麼多班,眼看出了成果,激動一下下,哈哈,隨之而來的是各種各樣的pv、uv的資料統計。 領導問:還會寫perl啊? 我答:會一些。 進入這個公司後,確實涉及到過perl指令碼,所以稍稍簡單的還能寫,所以對於領導交代的access_log日誌的處理,我寫完了,貼到自己部落格裡,以備下次回憶。
Time of Update: 2018-12-05
Introduction:Continuing with my backup articles (part two of my Amanda series coming soon...), I thought I would tell you about how I do my remote backups. The program I use is rdiff-backup, with a perl script to sort out e-mail notification and
Time of Update: 2018-12-05
我發下個人的連結:http://www.wachnew.com 以下是我學perl的時候記錄的一些知識點,方便以後查看,以下代碼是一個程式檔案,可以在perl解析器上成功運行。 #!/usr/bin/perl -w #知識點1:s/匹配模式串/替換串/;# s///替換成功後返回為真,否則為假$_ = "hello world, again..";s/hello/nice/; #用nice把hello替換掉print "$_/n";s//s(/w+)/ a man's $1/;print
Time of Update: 2018-12-04
《Perl編程24學時教程》試題一、單選題1、以下哪一個字串直接量的定義方式是錯誤的( )(1)'thank you'(2)" "(3)"a "friend" of yours"(4)"a /"friend/" of yours"2、以下哪一條語句是錯誤的( )(1)$_= 'hello world';(2)$a='hello world';(3)my $b,$a='hello world';(4)my ($a,$b)=(0,'hello
Time of Update: 2018-12-04
一、簡介 模式指在字串中尋找的特定序列的字元,由反斜線包含:/def/即模式def。其用法如結合函數split將字串用某模式分成多個單詞:@array = split(/ /, $line); 二、匹配操作符 =~、!~ =~檢驗匹配是否成功:$result = $var =~ /abc/;若在該字串中找到了該模式,則返回非零值,即true,不匹配則返回0,即false。!~則相反。 這兩個操作符適於條件控制中,如: if ($question =~ /please/) { print
Time of Update: 2018-12-05
use strict;use Cwd;use strict 'subs';use Win32::OLE qw(in);use Win32::OLE::Variant;$Win32::OLE::Warn = 3; # die on errors...my@files=("1.xls","2.xls","3.xls","4.xls","5.xls","6.xls"); foreach my$file (@files){ &EditExcel($file); alarm (15
Time of Update: 2018-12-05
前幾天在看Ultimate_ToolBox的原始碼,從codeproject上down下來一編譯,一堆錯誤,發現是由於編譯器無法識別ISO-8859-1編碼,誤讀有關字元造成的,所以立即著手準備轉換程式源檔案編碼,google了一把,也下了兩個小軟體,但是都沒有批量轉換功能,而有這功能的又不支援從ISO-8859-1到UTF-8的轉換,於是想到從前在FreeBSD下UTF-8和GB2312互相轉換的函數的iconv庫,我知道iconv不但是一個程式庫,而且有一個同名的應用程式能夠將檔案在兩種編碼
Time of Update: 2018-12-05
1. 任務 為了實現一些機械分詞演算法,準備使用“國家語委語料庫”的分詞詞表,線上下載到得詞表檔案是一個Excel檔案。本文的任務就是使用Perl從該Execl檔案中提取所有的詞語。 詞表檔案格式如下: 需要的詞語的位置在從第8行開始的,第B列的所有儲存格。一共有14629個詞語。(PS:語料庫的分詞詞表包含8萬多個詞語,但是線上下載到是出現次數在50次以上的詞語,只有這1萬多)。2. 使用什麼模組
Time of Update: 2018-12-04
mygrep:搜尋字串在某個檔案dir內,包括內部所有的子檔案夾,Win和*nix通用 1#!/usr/bin/perl 2 3 use strict; 4 use File::Spec::Functions; 5 6 my %usage={}; 7 $usage{"name"}="mygrep"; 8 $usage{"version"}="0.1"; 9 $usage{"author"}="xxx002";10
Time of Update: 2018-12-04
#!/usr/bin/perl# un-mangle c++ symbol# assuming the c++filt command is availableuse strict;use warnings;if ($#ARGV != 0) { print "usage:\n"; print "program filename\n";}my $in_filename = $ARGV[0]; open(my $in, "<", $in_filename) or die "Can'
Time of Update: 2018-12-05
Putty 關於Regex回顧:@array@ARGV 輸入命令的時候使用@marr 多維陣列su和sudo命令的區別http://linux.chinaitlab.com/command/730542_2.html:wq 強制性寫入檔案並退出。即使檔案沒有被修改也強制寫入,並更新檔案的修改時間。 :x 寫入檔案並退出。僅當檔案被修改時才寫入,並更新檔案修改時間,否則不會更新檔案修改時間關於查看使用者權限http://tech.ddvip.com/2008-01/1199915995
Time of Update: 2018-12-05
perl.exe 無法找到入口無法定位程式輸入焦點PL_Sv於動態連結程式庫Perl56.dll 今天安裝symbian S60-SDK-0616-3.0-mr.3.749.zip的時候,配置好環境,運行Carbide.c++ v2.0,建立好工程,編譯,可是每次都出現“perl.exe