#!/usr/bin/perl -w use strict; my @test = qw [ 3h4m 1h2m3s 1h5s 3m4s 1d2h3m4s 3x 2m2m 23h59m59s ]; foreach (@test) { my $s2t = string_to_time($_); my $t2s = time_to_string($s2t); printf ("%-15s %-10s %-10s\n", $_, $s2t, $t2s); }