[英]Carriage return in perl
while(<FILE>)
{
if (/progress/)
{
my @msgs = split(': ',$_);
print "$msgs[1]";
sleep 1;
}
local $| = 1; # to clear the buffer
print "\r"; # carriage return
}
I am reading from the <FILE>
for percentage progress, and print on the screen with carriage return but this doesn't seem to be working. 我正在从
<FILE>
读取进度百分比,并在屏幕上打印回车符,但这似乎不起作用。 Any idea or alternate way? 有什么想法或替代方法吗?
Because $msgs[1]
ends in a newline. 因为
$msgs[1]
以换行符结尾。 chomp
what you read from FILE
. chomp
您从FILE
读取的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.