my $start_time = time; END { my $exec_time = time - $start_time; print("Program took $exec_time seconds to execute\n"); } ...[ put rest of program here ]...
or if you want to include compile time
my $start_time; BEGIN { $start_time = time; } END { my $exec_time = time - $start_time; print("Program took $exec_time seconds to execute\n"); } ...[ put rest of program here ]...
Neither will include the time it took to load Perl itself.
Add use Time::HiRes qw( time ); if you want higher precision results.
In reply to Re: Question about time module
by ikegami
in thread Question about time module
by shartz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |