in reply to Re^2: How to add minutes with seconds?
in thread How to add minutes with seconds?

perl -e 'for (@ARGV) { /(d+):(\d+)/; $time += $1*60 + $2 } printf "%d:%.2d\n", $time/60, $time%60' 1:08 2:53 1:00

Replies are listed 'Best First'.
Re^4: How to add minutes with seconds?
by smokemachine (Hermit) on Mar 15, 2006 at 23:42 UTC
    perl -e '$_+=$a*60+$b while($a,$b)=split/:/,shift; printf"%d:%.2d\n",$ +_/60,$_%60' 1:08 2:53 1:00

      LOL. I should have known better. This is what I get with a bunch of hackers who play golf with their programming language. If I wait long enough I'm sure someone will condense the code down to a single character.

      Mike