字符串的比较应该是eq等,或者是只能匹配符,~~

2011/1/24 Andy Chen <[email protected]>

>  Exactly! I figured it out later. This tell us that we should always turn
> on the -w options, it actually complains about the '==' operator.
>
> Regards! Andy Chen
>
>
>
> > Date: Fri, 21 Jan 2011 07:33:57 +0800
> > Subject: Re: [PerlChina] My test case failed in this way
> > From: [email protected]
> > To: [email protected]
>
> >
> > 你用错了操作符
> > 应该用eq,ne
> > 转成数字后是nan,然后nan和nan比较都是不等的.所以....
> >
> > 在 2011年1月21日 上午12:08,Andy Chen <[email protected]> 写道:
> > > Run following code, tell me your result.
> > >
> > > #!/usr/bin/perl
> > >
> > > my $a= "nAnQpW9mVV0TWLgbLgriCu6Tp2f2ymI7HUZfJS";
> > > my $b= "nAnQpW9mVV0TWLgbLgriCu6Tp2f2ymI7HUZfJS";
> > >
> > > if($a != $b)
> > > {
> > > print("not equal!\n");
> > > }
> > > else
> > > {
> > > print("equal!\n");
> > > }
> > >
> > > if("$a" != "$b")
> > > {
> > > print("not equal!\n");
> > > }
> > > else
> > > {
> > > print("equal!\n");
> > > }
> > >
> > > if(qw/$a/ != qw/$b/)
> > > {
> > > print("not equal!\n");
> > > }
> > > else
> > > {
> > > print("equal!\n");
> > > }
> > >
> > > --
> > > 您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
> > > 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> > > 要取消订阅此网上论坛,请发送电子邮件至 
> > > [email protected]<perlchina%[email protected]>
> 。
> > > 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
> > >
> >
> > --
> > 您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
> > 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> > 要取消订阅此网上论坛,请发送电子邮件至 
> > [email protected]<perlchina%[email protected]>
> 。
> > 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
> >
>
> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 
> [email protected]<perlchina%[email protected]>
> 。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>



-- 
nothing is impossible to a willing heart

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

回复