我使用的是从以下网站 ActiveState 安装了最新版本 ActivePerl 的 Windows 盒子,并且我有一个问题是一个非常简单的小于“<”的概念。
我有以下代码:
#!/usr/local/bin/perl
use warnings;
use strict;
my $a = 1;
if(1 < $a)
{
print "true";
}
当我在命令提示符中执行脚本时,“true”永远不会打印出来。我在这里缺少什么简单的逻辑?我在 C++、C# 和 java 中多次使用了这个表达式,但由于某种原因它在这里不起作用。
如果我错过了一些简单的事情,请友善。我花了很多时间想知道发生了什么事。
谢谢你,
韦斯利
I am using a windows box with the latest version of ActivePerl installed from the following website ActiveState and I am having an issue with a really simple concept of Less Than '<'.
I have the following code:
#!/usr/local/bin/perl
use warnings;
use strict;
my $a = 1;
if(1 < $a)
{
print "true";
}
When I execute the script in a command prompt, "true" never prints out. What simple logic am I missing here? I have used this expression plenty of times in C++, C# and java but for some reason it is not working here.
If I missed something simple, please be nice. I have spent quite a bit of time wondering whats going on.
Thank you,
Wesley
发布评论
评论(1)
嗯...如果 $a 为 1,则条件为 false,并且不会打印“true”。 我错过了什么吗?
Um... if $a is 1, the condition is false, and "true" will not print. Did I miss something?