How can I update values on the screen without clearing it in Perl?

前端 未结 3 1432
情深已故
情深已故 2020-12-17 03:52

I want to display a set of values on screen and update that value every 5 seconds. I don\'t want to clear the screen.

eg:

hours: 1

mins : 30

3条回答
  •  生来不讨喜
    2020-12-17 04:39

    Something like this:

    use Term::ANSIScreen qw(cls);
    while(1) {
        cls;
    
        print "....";
    
        sleep 5;
    }
    

    Alternatives of "cls" can be found in this question.

提交回复
热议问题