#!/bin/env perl use strict; my $sec = 0; foreach (@ARGV) { /^(\d+):(\d{2})$/ or next; $sec += ($1 * 60) + $2; } # foreach (adding up times) print( int( $sec / 60 ), ":", ($sec % 60), "\n" ) if $sec > 0;