Converting to seconds seems like a sensible approach. You could do it like this:
use List::Util qw/ sum /;
# calculate total number of seconds
$seconds = sum map {
my ($m,$s) = split /:/;
$m*60 + $s
}
qw/ 01:45 60:00 45:25 /; # or your array with times
$minutes = int($seconds / 60); # integral number of minutes
$seconds = $seconds % 60; # remaining seconds
$new_time = sprintf "%02d:%02d", $minutes, $seconds;
perl -e '($sec, $min)=localtime time; printf "%.2d:%.2d", $min, $sec'or
perl -e '$,=":";print reverse @ms=(localtime)[0, 1];'
Apart from that, the next time you post a question like this, show us some code that you have tried. If all you give us is "I am currently losing some minutes", all we can say is "well, where were they when you last saw them? Have you checked all your pockets?"
(For that matter, if you're still having trouble with this problem, you can post some code so we can help you look for those missing minutes.)
perlmonks.org content © perlmonks.org and Anonymous Monk, dolavoie, graff, rhesa, smokemachine
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03