in reply to Timing a process

This is also relatively easy to accomplish without moudules (although modules are easier since the hard stuff is already done). But in the interest of learning more about perl.....

time() returns the seconds from the epoch (Jan 1, 1970 on most systems). So $begining_time - $end_time will give you the number of seconds it took your script to run. From there, getting the hours, minutes, seconds is really just a matter of doing some math.

Here is a quick one:

$total_time = $end_time - $begining_time; # get the total minutes $minutes = ($total_time / 60); # get the reminader for seconds $seconds = ($total_time % 60); # get the total hours $hours = ($minutes / 60); # and re-adjust minutes to be just the minutes $minutes = ($minutes % 60); # I use printf here to make sure we have integers printf "%d hours, %d minutes, %d seconds", $hours, $minutes, $seconds;

-stvn