if (not defined $a || $a == 0  )
优先级问题,本意是 ( (not defined $a) || $a == 0  ),实际是 (not ( defined $a || $a == 0 ) )

perl 里面 ! 和 not,and 和 && 优先级不一样。

2012/8/6  <[email protected]>:
> 新手求教什麽坑?
>
>
>
> -- Sent from my HP TouchPad
> ________________________________
> On 6 Aug 2012 21:09, Huangj <[email protected]> wrote:
> 俺都介么写
>
> my $y;
> unless ( $y ) { print 1; }
>
>
>
> 在 2012-06-29 13:19:39,"joe jiang" <[email protected]> 写道:
>
>   DB<7> print 1 if !defined $a or $a == 0;
> 1
>
>
> 2012/6/29 cnhack TNT <[email protected]>
>>
>> 同掉过,路过。。。
>>
>>
>>
>> 2012/6/29 wd <[email protected]>
>>>
>>> #!/usr/bin/perl
>>>
>>> use strict;
>>> use warnings;
>>>
>>> my $a;
>>>
>>> if ( not defined $a || $a == 0 ) {
>>>    print 1;
>>> }
>>>
>>> 就这段代码。。明眼人应该能看明白错在哪里。。。我已经掉进去好几次了。。。好像还在持续的掉。。nnd。。。
>>>
>>> --
>>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>>> 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
>>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>>
>>
>> --
>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>> 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>
>
> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>
>
>
> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>
> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

-- 
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

回复