in reply to Getting times (weeks, days, hours, minutes, seconds)
use strict; use warnings; my @times = qw( 5:21 8:01 5:37 7:19 5:46 7:44 6:43 7:17 8:02 6:50 7:54 + 8:44 ); my $total_seconds; for my $time (@times) { my ($mins, $secs) = split(/:/, $time); $total_seconds += $mins*60 + $secs; } my $total_minutes = int($total_seconds/60); $total_seconds -= $total_minutes*60; my $total_hours = int($total_minutes/60); $total_minutes -= $total_hours*60; printf("%s hours, %s minutes, %s seconds\n", $total_hours, $total_minutes, $total_seconds, );
It is the -> and the printf (which has never made sense to me) that have me stumped.
$t->printf is a method call just like the preceding $t->calc, $t->new_delta and Date::Manip::Delta->new.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Getting times (weeks, days, hours, minutes, seconds)
by Lady_Aleena (Priest) on Jul 06, 2010 at 20:39 UTC | |
by ikegami (Patriarch) on Jul 06, 2010 at 21:27 UTC |