在输入的过程中主义使用chomp才能够得到正确的结果
如下程序:
print "Please input an string and a number by order!\n";
$the_string=<>;
$the_numb=<>;
print "The result is \n";
print "$the_string"x"$the_numb";
结果如下:
The result is
my
my
my
my
my
这里的问题便是没有使用chomp引起的
如果加入chomp如下:
print "Please input an string and a number by order!\n";
chomp($the_string=<>);
chomp($the_numb=<>);
print "The result is \n";
print "$the_string"x"$the_numb";
那么就会得到如下的结果:
The result is
mymymymymy