瀏覽模式: 普通 | 列表

使用 Getopt::Long

use strict;
use Getopt::Long;
my ($file,$number);
GetOptions (
        "file=s" => \$file,
        "number=i" => \$number,
);

print <<EOF;

file=$file
number=$number

EOF

下了指令

[閱讀全文]

perl 所謂的參照

參照好像很複雜,應該是

我也還沒完全理解,

不過我起麻應該算是小小的用到它了

實際的例子

sub aa {

        my %a = (
                a=>1,
                b=>2,
        );

        return \%a;
}

上面在回傳的時後多了 \

[閱讀全文]

標籤: perl reference ref

perl 的map功用

quote : http://note.tcc.edu.tw/217.html

1. 將 qw LIST 中的數值開根號 x10
my @array = map { sqrt($_)*10 } qw/50 60 70 75 91 18 39 66/;

2. 將 0-9 平方後丟到 @array中 @array=(0,1,4,9,16,25,36,49,64,81)
my @array = map { $_ ** 2 } (0..9);

3. 將清單加上@domain name,注意這裡的 '@note.tcc.edu.tw' 是以單引號括起,否則用雙引號會把 @note 視為陣列
@user= (' axer', 'john', 'peter', 'lee');
@mail = map {  $_ .  '@note.tcc.edu.tw' } @user;

結果 @mail= ( ' axer@note.tcc.edu.tw', 'john@note.tcc.edu.tw', 'peter@note.tcc.edu.tw', 'lee@note.tcc.edu.tw' );

4. 下例map 將@m 陣列中的字串空白移除,@m 本身被改變
@m=("   www",  "facility ", " mail ");
map { s/s+//g } @m;
print "@m ";

結果 www facility mail

標籤: perl map

perl 關於排序功能

由值排序hash
foreach $value (sort {$coins{$a} cmp $coins{$b} }  keys %coins)
{
    print "$value $coins{$value}";
}
# ref :http://note.tcc.edu.tw/285.html

sort 以 ASCII 順序來將陣列排序

@a =qw(11 1 5 7 2);

@b = sort @a;
print join ',',@b," ";

sort 以數值大小排序

[閱讀全文]

標籤: perl 排序 sort

rbl 通常會用在郵件服務上面,假如你的ip被列入黑名單,如果是,你的信可能就寄不到有使用這些 rbl list 的 mail server了

可以用這個 http://www.anti-abuse.org/ 來檢查

在右手邊有個 Multi-RBL check,輸入你的 ip或 網址後按check
attachments/201108/9631327861.jpg

會幫你列出各家 rbl 的狀態

[閱讀全文]

hping 類似 ping 的網路封包測試工具

http://www.hping.org/

hping 是一個封包分析工具,它類似於 ping ,但比它強很多

支援 ICMP, TCP, UDP, RAW-IP, traceroute mode

也可以作以下測試用
  • Firewall testing
  • Advanced port scanning
  • Network testing, using different protocols, TOS, fragmentation
  • Manual path MTU discovery
  • Advanced traceroute, under all the supported protocols
  • Remote OS fingerprinting

[閱讀全文]

遇到 nfs 無法被 umount的問題

當我 umount /media/usbdisk時,出現
umount.nfs: 10.10.10.166:/media/usbdisk: not found / mounted or server not reachable
解決方式:

編輯 /etc/mtab,將掛載/media/usbdisk的那行註解

再次 umount 就可以了

標籤: nfs mount umount