in reply to Verifying a date

What do you consider a "valid date"?

Maybe try writing down what the program should do and what rules it should enforce. Then take those rules and write them in Perl code.

For a start, the following program provides a framework for you:

#!perl use strict; use warnings; use Test::More tests => 'no_plan'; sub verify_date { my( $date ) = @_; }; my @testcases = ( [ '01-01-70', 1 ], # ok [ '01-12-70', 1 ], # ok [ '12-01-70', 1 ], # ok [ '12-01-12', 1 ], # ok [ '12-12-01', 1 ], # ok [ '70-01-01', 0 ], # not ok [ '02-30-70', 0 ], # not ok [ '02-02-1970', 0 ], # not ok [ 'ab-02-1970', 0 ], # not ok ); for my $testcase ( @testcases ) { my( $value, $expected ) = @$testcase; is verify_date( $value ), $expected, $value; }; done_testing;