perl 異常總結

2021-06-20 12:18:00 字數 937 閱讀 8610

1. pseudo-hashes are deprecated

the "pseudo-hashes are deprecated" error means you're trying to access an array as a hash, which means that either$data->or$data->is an arrayref.

2.  defined 解釋

用於判斷變數是否為 undef,未定義, 不能用於陣列和hash

many folks tend to overusedefinedand are then surprised todiscover that the number0and""(the zero-length string) are, in fact,defined values.

0and""(the zero-length string 用 if () 來判斷即可

3.  or  ||   和 and &&的區別

本身沒有區別,習慣問題 ,但是有時候牽涉到運算子優先順序的問題,結果會不同

left        &

left        | ^

left        &&

left        || //

nonassoc    ..  ...

right       ?:

right       = += -= *= etc.

left        , =>

nonassoc    list operators (rightward)

right       not

left        and

left        or xor

perl實現異常時報警

usr bin perl w use dbi use lwp qw get driver mysql dbh dbi connect dbi mysql csunet localhost root die can not connect database 產生當天日期 year gmtime tim...

總結 Perl技巧

1.perl超時機制eval sub alarm 10 my startcmdresult qx tmpcmd alarm 0 if timeout 2.忽略sigchld訊號,避免產生殭屍程序 sig ignore 3.等待 sub show flower print r local 0 4.pe...

Perl語言總結 3

1.2.4 複雜資料結構 wife leah rachel bilhah zilpah 錯誤 wife leah rachel bilhah zilpah 正確 用 中括弧來將乙個列表轉換成乙個標量。wife 0 leah rachel bilhah zilpah 正確 wife leah rach...