use Time::HiRes qw( time ); my $start = time; # your code here printf "Took %.3f seconds\n", time - $start;