Perl: print back to beginning of line

后端 未结 4 2003
眼角桃花
眼角桃花 2020-12-07 01:28

Okay, so what I\'m trying to do is print out a percentage complete to my command line, now, I would like this to simply \'update\' the number shown on the screen. So somehow

4条回答
  •  一个人的身影
    2020-12-07 02:25

    You can also use \b to move back one character:

    local $| = 1; #flush immediately
    print "Doing it - 10%";
    sleep(1);
    print "\b\b\b";
    print "20%";
    print "\n", "Done", "\n";
    

提交回复
热议问题