標籤:光碟片鏡像 linux verify 作業系統 media 參考:http://hi.baidu.com/pengduo66/item/abfe454f81cdb7e5a4c06675 情境說明:選擇迷你安裝linux作業系統,沒有安裝perl工具。由於網路的故障問題,無法使用yum install perl
一開始打算用perldoc看Apache2::Request模組,結果在運行時出現如下錯誤:複製代碼 代碼如下:Error in tempfile() using /tmp/XXXXXXXXXX:parent directory (./) isnot writable at /usr/lib/perl5/5.8.8/Pod/Perldoc.pm line
該模組用perl的數組代表一個檔案,檔案的每一行對應數組的一個元素,第一行為元素0,第二回為1,... 檔案本身實際並不載入到記憶體,對數組元素的操作立刻作用到檔案裡。最大的方便是可以任意指定處理開頭結尾的某幾行。基本用法:複製代碼 代碼如下:use Tie::File;tie @array, 'Tie::File', filename or die ...;$array[13] = 'blah'; # line 13 of the file is now 'blah'print
反向串連代碼: 1. #!/usr/bin/perl 2. #usage: 3. #nc -vv -l -p PORT(default 1988) on your local system first,then 4. #Perl $0 Remote IP(default 127.0.0.1) Remote_port(default 1988) 5. #Type 'exit' to exit or press Enter to gain shell when u under
方法一: 5.8版本 使用Switch包 use Switch; switch ($val) { case 1 { print "number 1" } case "a" { print "string a" } case [1..10,42] { print "number in list" } case (@array) { print "number
原文發表在網易部落格 2010-11-06 13:07:36 第1題和第2題#!perl -w #chapter 4 , exercise one and two use strict; sub total{ my $sum; foreach $_ (@_){ $sum += $_; } $sum; } my @fred=(1,3,5,7,9); print "
Perl支援把你的pod格式文字塊產生文檔,這個pod格式文字塊可以是植入在代碼裡的標記語言,也可以是單獨的一個檔案。有了pod,只要在寫指令碼的時候,隨手記下想法、說明,就不用再另外編寫文檔了,非常方便。建議先仔細讀一讀perldoc perlpod裡面的內容,文檔詳細介紹了pod標記語言的文法。$ perldoc perlpod盡量保證一個比較好的書寫習慣,例如:=pod=head1 NAMEWater::Test – The great new Water::Test!=head1
①檔案操作使用Perl從檔案中讀取字串,一般有兩種方法:1. 一次性將檔案中的所有內容讀入一個數組中(該方法適合小檔案):Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->open(FILE,"filename")||die"can not open the file: $!";@filelist=<FILE>;foreach