2010年7月30日星期五

Re: [PerlChina] 这个算bug吗?

别用 == 比较字符串。。。

2010/7/30 cnhack TNT <cnhacktnt@gmail.com>:
> 字符串比较请用 eq, ne
>
> 2010/7/30 snyh <snyh@snyh.org>
>>
>> 按照自然语言来看
>> 字母转换成 0 而不是它的ASCII码 应该更合理吧。 。。
>>
>> 在 2010年7月30日 下午5:09,snyh <snyh@snyh.org> 写道:
>> > 0 == 0
>> >
>> > perl 里面字符串不像C会把 char 转换成int
>> > 'G' == 0 is true.
>> > 'a' == 0 is true.
>> > 'ab123' == 0 is ture.
>> > '0adb' == 0 is ture.
>> > '12abc' == 0 is false.
>> >
>> >
>> > 在 2010年7月30日 下午3:13,Wan Li <wanliyou@gmail.com> 写道:
>> >> 平常写也打开
>> >> use strict;
>> >> use warnings;
>> >>
>> >> --
>> >> 您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
>> >> 要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com
>> >> 要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com
>> >> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>> >>
>> >
>>
>> --
>> 您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
>> 要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com
>> 要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com
>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>
>
> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
> 要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com
> 要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>

--
-----------------------
http://easun.org

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

没有评论: