in reply to How to add minutes with seconds?
Hi gube, as Corion suggested you can do it simply without using module. Here is my try, but it can be still simplified.
use strict; my @a = qw(1:08 2:53 1:00); my ($tt, $mins, $sec); for my $t (@a) { my ($m, $s) = split /:/, $t; my $tm = $m*60; $tt = $tt + $tm + $s; } $sec = sprintf ("%02d", $sec = $tt%60); #seconds $mins = int($tt/60); #minutes print "$mins:$sec";
Prasad
|
|---|