Time of Update: 2017-01-18
雖然建議在每個Perl指令碼和模組中開啟警告,可是你又不想使用者看到Perl發出的警告。一方面你想在代碼前面使用use warnings作為你的安全網,另一方面,通常警告會出現在螢幕上。多數情況下,客戶不知道如何處理這些警告。如果幸運的話這些警告僅僅讓客戶驚訝一下,當然,不幸的是他們嘗試著去修複它們... (這裡說的不是Perl程式員。)第三方面,你或許想要儲存這些警告供之後分析。此外,在很多地方還有很多Perl指令碼和應用程式沒有使用use
Time of Update: 2015-07-30
標籤:以前寫過類似的部落格: http://blog.csdn.net/three_man/article/details/34084361 今天拿出來,再好好剖析一下:1. 構造一個含有重複元素的數組my @arr1 = (1 .. 10);my @arr2 = (5 .. 15);# join multi arraymy @arr = (@arr1, @arr2);2. 刪除數組中的重複元素sub removeRepeat{ my $arrRef = shift; my
Time of Update: 2015-07-20
標籤:相信有很多人初學編程的人會在語言選擇困難症。說白了,我認為大多數人都害怕自己選擇的語言會被淘汰或者使用不廣泛,今天我就來談談關於程式設計語言選擇的那點事。我想拿perl和python來舉例說明,因為這兩門語言的關係就跟java和c++一樣,perl陣營和python陣營都各自有各自的理由。語言的選擇和作業系統的選擇很類似,有的人愛用linux有的人愛用windows,至於說到底是linux好還是windows好,誰也說不清。在日常工作中,windows無疑有巨大優勢,但是在專業領域,lin
Time of Update: 2015-12-08
標籤:錯誤如下:perl: warning: Setting locale failed.perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.UTF-8"are supported and installed on your system.perl: warning: Falling back to the
Time of Update: 2015-10-19
標籤:正則引擎的分類 正則引擎的分類正則引擎的分類主要分兩種:DFA:egrep、awk、lex、flexNFA:.NET、PHP、Perl、Ruby、Python、GNU
Time of Update: 2015-10-12
標籤:1.使用Regex修改文本 1.使用Regex修改文本Regex的功能不只有查詢,還可以對文本進行修改,例如替換$var=~m/regex/i $var=~s/regex/replacement/iReplacement兩側的斜杠相當於雙引號,也就是說replacement中可以有$1,$2這樣的變數來代表前面匹配到的內容
Time of Update: 2015-07-10
標籤:讀取標準輸入用<STDIN>進行標準輸入:chomp($line=<STDIN>);如果讀到檔案尾,行輸入操作符就會返回undef。便可利用這一性質跳出迴圈。while(defined ($line=<STDIN>)){ print "I saw $line";}簡寫為:while(<STDIN>){ print "I saw $_ .";}注意:這個簡寫只在最早的寫法中才能正常運行,如果將行輸入操作符放在其他的任何地方(特別是自成一行)
Time of Update: 2015-01-09
標籤:0x00 背景前幾天有個人在某大會上講了一個在perl中存在了20年的問題。作為一個只會perl不會python的人,真的很心痛。看完視頻後感覺被黑的吃不下東西。這儼然就是一場對perl的吐槽批鬥大會,整個演講充滿了sucks、fuck等和諧詞彙,也能看出演講者是多麼的義憤填膺,場下一次次的鼓掌和附,嗯,讓我想起了郭德綱。0x01 問題言歸正傳,這個在perl中存在了20年的問題到底是啥呢?拋去perl的文法的槽點,真正的問題在data
Time of Update: 2015-01-04
標籤:perl ldap About LDAP:LDAP stands for Lightweight Directory Access Protocol. It is usually used to fetch (and sometimes update) data in a directory of people.Using Net::LDAP module in Perl can provide a
Time of Update: 2015-03-03
標籤:perl#!/usr/bin/perluse strict;use warnings;#This is a practice of perl, as which shows with below perl code...codes.print "Hello, world!\n";my $animal = "camel\n";my $answer = 42;printf $animal;print "The animal is
Time of Update: 2014-09-17
標籤:blog http io os 使用 ar for 檔案 資料
Time of Update: 2014-09-15
標籤:blog io os 使用 java ar for 資料 div Perl“膠水”,能夠將各種應用程式或者各種語言的代碼結合起來。Perl可以編寫普通的指令碼程式,
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-07-22
標籤:style os for re c line Perl語言編程不安全語法檢查可用下面兩個命令: #!/usr/bin/perl -w 或者: use warnings;
Time of Update: 2018-12-08
圖:複製代碼 代碼如下:#!/usr/bin/perl## fdupe tool - finding duplicate files## $Id: fdupe,v 1.7 2011/10/14 20:11:21 root Exp root $## Source code Copyright (c) 1998,2011 Bernhard Schneider.# May be used only for non-commercial purposes with# appropriate
Time of Update: 2018-12-08
為何使用引用?在perl4中,hash表中的value欄位只能是scalar,而不能是list,這對於有些情況是很不方便的,比如有下面的資料:Chicago, USAFrankfurt, GermanyBerlin, GermanyWashington, USAHelsinki, FinlandNew York, USA我們想要按國家將城市分類,每個國家後面對應城市列表,如果用perl4來做,必須將城市列表組合成字串才行,如果用perl5就可以用引用來做,有了引用,就可以構造複雜的hash結構,
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-07
基類是一個作業系統類 代碼Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->package os;require Exporter;@ISA = qw(Exporter);@EXPORT = qw(temp);sub getDF{}sub temp{my $this = shift;print $this->getDF();print "\n";
Time of Update: 2018-12-07
本文所用到的Perl調試器為Perl解譯器本身,可以通過-d開關開啟調試功能。本文不會將涵蓋所有的調試命令,只會解釋一些我們常用的調試命令,希望對熱愛Perl的朋友有所協助。 開啟調試開關 Perl是解釋型語言,運行一個Perl指令碼,可以通過在命令列中敲入形如 Perl Test.pl 的命令直接解釋執行。如果想調試我們的指令碼程式,可以加上-d選項,命令為perl -d Test.pl,斷行符號後程式會停在DB<1>處,如所示:
Time of Update: 2015-01-23
How to debug in Perl ?,debugperlIf it is a small program, you can use this way: C:\Rebecca\script\perl>perl -d calculate.pl Loading DB routines from perl5db.pl version 1.39_10Editor support available. Enter h or 'h h' for help, or '