不过,my $a 之后,一旦在它的lexical scope 里用 sort 就悲剧了。这样说来, my $a 的确是个坑

2012/8/7 Robin Lee <[email protected]>

> $a $b 只在 sort 里是预设变量。在其它地方没有特别
>
>
> 2012/8/7 Anthony WU <[email protected]>
>
>> 不是�@�����}
>> 而是 $a�c$b都是�A�O��量………
>> -------- Original Message --------
>> Subject: Re: [PerlChina] 一个坑,自己掉进去好几次了。。。
>> From: wd <[email protected]>
>> To: [email protected]
>> 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  <[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 访问此网上论坛。
>>
>>
>

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

回复