#!/usr/bin/perl -w use strict; my $start = time; # let's see what time it is our $gap ||= 1; # how many seconds between prints while (1) { # and from now on local $| = 1; my $now = time; # see what time it is now my ( $sec, $min, $hour ) = ( $now - $start, 0, 0 ); # seconds passed while ( $sec > 3600 ) { $sec -= 3600; $hour++ } # hours while ( $sec > 60 ) { $sec -= 60 ; $min++ } # minutes printf ("\r%02d:%02d:%02d",$hour,$min,$sec); # print time sleep($gap); # wait a while }