Me too a beginner, posting a reply in childish speech:


 1 #!/usr/bin/perl
  2 use warnings;
  3 use strict;
  4 use Time::HiRes qw(gettimeofday);
  5 use Time::Local;
  6 use Time::localtime;
  7
  8 my $t0 = gettimeofday;
  9
 10 my $forlocaltime = int($t0);
 11 my $for_millisecond = int(($t0-$forlocaltime)*1000);
 12 
 13
 14 my $tm = localtime($forlocaltime);
 15
 16 printf ("Current Time- %02d:%02d:%02d:%03d %02d/%02d/%02d\n", $tm->hour, 
$tm    ->min,$tm->sec,$for_millisecond, $tm->mday, $tm->mon+1, $tm->year+1900);



Output - 
Current Time- 17:09:04:312 03/06/2011
Current Time- 17:09:08:140 03/06/2011


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to