Tuesday, March 12, 2013

How could you estimate the elapsed time for execution of a script in Perl?

#!/usr/bin/perl
use Time::HiRes;

my $start = Time::HiRes::gettimeofday();
## -- Your Code -- ##
my $end = Time::HiRes::gettimeofday();

printf("$0 took %.4f seconds!\n", $end - $start);

No comments :