use strict; my @lines0; # using your array name # ...do whatever you do to fill @lines0... my $totalsec = 0; for ( @lines0 ) { my @words = split /\s+/; my ( $hrs, $mins, $secs ) = split /:/, pop @words; $totalsec += ( $hrs * 60 + $mins ) * 60 + $secs; } printf( "Total time is %d minutes and %d seconds\n", int( $totalsec / 60 ), $totalsec % 60 );