# Countdown Timer sub sleep_count { my $minutes = shift; my $string = shift; my $command = shift; my $command_time_interval = shift; my $countdown = $minutes*60; # in secs. $| = 1; my $beg_time = time; my $end_time = $beg_time + $countdown; for (;;) { my $time = time; last if ($time >= $end_time); printf("\r[ %02d:%02d ] $string", ($end_time - $time) / ( 60) % 60, ($end_time - $time) % 60, ); sleep(1); } }