use Time::Local "timegm"; sub bad_date { my ($y,$m,$d) = @_; ! defined eval { timegm(0,0,0,$d,$m-1,$y) } }