有人能指出我的错误吗?
while(<STDIN>){
my $reverse = reverse $_; #(explicit - to force casting)
if( 5 <length ){
print "Reverse is $reverse\n";
}
else{
print; #this will print $_ scalar context
}
}
执行程序,
1234567
Reverse is
7654321
但如果我
print "Reverse is $reverse\n";
改为print "$reverse\n"
1234567
7654321
有人可以解释发生了什么吗?我怎么能删除换行符?