#!/usr/bin/perl -w use strict; use Date::Simple ('date', 'today', 'ymd'); my %months = ( "jan" => "1", "feb" => "2", "mar" => "3", "apr" => "4", "may" => "5", "jun" => "6", "jul" => "7", "aug" => "8", "sep" => "9", "oct" => "10", "nov" => "11", "dec" => "12", ); my $year = today()->year; print "Enter a month and day:\n"; my ($month1, $day1) = split /\s+/, ; chomp($month1, $day1); $month1 = lc $month1; $month1 = substr($month1,0,3); $month1 = $months{$month1}; print "Enter a month and day:\n"; my ($month2, $day2) = split /\s+/, ; chomp($month2, $day2); $month2 = lc $month2; $month2 = substr($month2,0,3); $month2 = $months{$month2}; my $date1 = ymd($year, $month1, $day1); my $date2 = ymd($year, $month2, $day2); my $diff = $date2 - $date1; print "Difference is $diff.\n";