简体   繁体   中英

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. Any idea or alternate way?

Because $msgs[1] ends in a newline. chomp what you read from FILE .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM