Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I pause program execution for one second in Perl?

Tags:

perl

Could anyone show me an example of how to pause for one second in Perl? I am trying the sleep command and it isn't working.

like image 549
Christopher Peterson Avatar asked Nov 27 '22 02:11

Christopher Peterson


1 Answers

#!/usr/bin/perl

use strict;
use warnings;
use diagnostics;

$| = 1; # Disable output buffering

for (1..10) {
        print '.';
        sleep 1;
}
print "\n";
like image 53
Quentin Avatar answered Nov 29 '22 15:11

Quentin