use strict; use warnings; use Date::Calc qw(check_date); my ($mday, $mon, $year) = qw(28 02 2012); if (check_date($year,$mon,$mday)){ ####Your stuffs here } else{ print "Check the date is not a valid one\n"; }