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