#!perl -w

use strict;
no strict "vars";

use Date::DateCalc qw(date_to_short dates_difference);

use Date::DateCalcLib qw(decode_date_us);

print "\n";

$ok = 0;
while (! $ok)
{
    print "Please enter the date of your birthday (month-day-year): ";
    $date = <STDIN>;
    print "\n";
    if (($yy1,$mm1,$dd1) = decode_date_us($date))
    {
        $datestr = date_to_short($yy1,$mm1,$dd1);
        print "Your date is: $datestr\n";
        print "\n";
        print "Is that correct? (Yes/No) ";
        $response = <STDIN>;
        print "\n";
        $ok = ($response =~ /^Y/i);
    }
}
print "Your birthday is: $datestr\n";
print "\n";

$ok = 0;
while (! $ok)
{
    print "Please enter today's date (month-day-year): ";
    $date = <STDIN>;
    print "\n";
    if (($yy2,$mm2,$dd2) = decode_date_us($date))
    {
        $datestr = date_to_short($yy2,$mm2,$dd2);
        print "Your date is: $datestr\n";
        print "\n";
        print "Is that correct? (Yes/No) ";
        $response = <STDIN>;
        print "\n";
        $ok = ($response =~ /^Y/i);
    }
}
print "Today's date is: $datestr\n";
print "\n";

$days = dates_difference($yy1,$mm1,$dd1,$yy2,$mm2,$dd2);
print "You are $days days old.\n";
print "\n";

__END__

