【发布时间】:2014-03-28 02:28:47
【问题描述】:
下面是我的 Perl 程序:
my $var1='perfp2u1@vanlync2k13.com';
my $var2='PerfP2U1@vanlync2k13.com';
if($var1 eq $var2){
print "match";
}
else{
print "no match";
}
输出是:
no match
我不知道为什么程序不能正常工作?????? 对于上述程序,我希望输出“匹配”。
以下是我的 straberry perl 版本详情(操作系统:windows 7)。
D:>perl -version
This is perl 5, version 16, subversion 2 (v5.16.2) built for MSWin32-x64-multi-t
hread
Copyright 1987-2012, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
【问题讨论】:
-
当字符串明显不相等时,为什么会期望“匹配”?
-
eq区分大小写,因此您的字符串不匹配,因为$var2大写为Ps。 -
这对我来说似乎是不言而喻的。您的输出是
no match,因为字符串不匹配。您的程序运行正常。
标签: perl