perl 异常总结

前端之家收集整理的这篇文章主要介绍了perl 异常总结前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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->{file} or$data->{file}{path} is an arrayref.


2.  defined 解释

  用于判断变量是否为 undef,未定义, 不能用于数组和hash

Many folks tend to overuse defined and are then surprised todiscover that the number0 and "" (the zero-length string) are,in fact,defined values.

  0 and "" (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相关文章