0
我有下面的if语句,'!='不起作用。这行代码中的第二条if语句不起作用,有人能告诉我为什么吗?!=操作员不工作
if ($line =~ $search) {
print "$line <br> <br>";
}
}
if ($line != $search) { #This if statement will not work
print "word is not in file";
}
“不工作”是什么意思?您是否使用过Data :: Dumper或类似模块来转储两个变量以查看它们包含的内容? – 2014-11-14 22:25:45
可能的重复[如何比较Perl中的两个字符串?](http://stackoverflow.com/questions/1175390/how-do-i-compare-two-strings-in-perl) – 2014-11-14 22:25:57
'if ($ line =〜$ search)'是'else ...'。 – TLP 2014-11-15 00:39:12