$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;