use strict ; use Time::HiRes qw(gettimeofday) ; sub Test { # sec: seconds # usec: microsecond my ($start_sec, $start_usec) = gettimeofday() ; #======================# # Place your code here!# #======================# my ($end_sec, $end_usec) = gettimeofday() ; # Compute time elipsed my $timeDelta = ($end_usec - $start_usec) / 1000 + ($end_sec - $start_sec) * 1000; print $timeDelta ; } &Test() ; 1 ;