use Time::Local; (...) next unless (m{^(\d{4})-(\d\d)-(\d\d)$}); print "$3.$2.$1\n"; $next = timegm(0,0,0,$3,$2,$1-1900);