if (($yyyy, $mm, $dd) = ($date =~ /(\d+)-(\d+)-(\d+)/)) { $epoch_seconds = timelocal(0, 0, 0, $dd, $mm, $yyyy-1900); $strings = localtime($epoch_seconds); print "$date : $epoch_seconds\n" if $date lt $cutoff; } else { # do something here when the line does not contain a date }