我正在运行Windows XP,带有EPIC的Eclipse 3.2和用于我的Perl解释器的Cygwin,我得到了意想不到的结果.
仅供参考...当我在我的Ubuntu发行版(VMware,同一台PC)上运行时,我得到了预期的结果.为什么?
############ CODE: #############
use warnings;
use strict;
my $test = "test";
my $input = <STDIN>;
print length $test, " ", length $input, "\n";
chomp $input;
print "|$test| |$input| \n"; #The bars indicate white space, new line, etc...
print length $test, " ", length $input, "\n";
if ($test eq $input) {
print "TIME TO QUIT";
}
Run Code Online (Sandbox Code Playgroud)
Windows XP上的结果:
test <-- My input
4 6 <-- Lengths printed before chomp
|test| |test <-- Print the variables …Run Code Online (Sandbox Code Playgroud) perl ×1