#!/usr/bin/perl -w use warnings; use strict; use Getopt::Long; use Time::Local; use POSIX qw(strftime); # The idea is to take an input date and add 6 days to it. # It seems to work except when the start date is November 1! # # Below is an example: # my $input_date; GetOptions("start_date=s" => \$input_date); print "\nWe expect a start day and a day 6 days later than that!\n"; my @date_pieces = split('/',$input_date); my $start_day = timelocal(0, 0, 0, $date_pieces[1], $date_pieces[0]-1, $date_pieces[2]); my $end_day = $start_day + 6*24*60*60; my $new_start_day = strftime "%m/%d/%Y", (localtime($start_day)); my $new_end_day = strftime "%m/%d/%Y", (localtime($end_day)); print "The start day is $new_start_day and the end day is $new_end_day\n"; #### $ LIST="09/20/2008 1/1/2009 11/3/2008 06/06/2006 11/1/2008 11/1/2008 10/1/2008" $ for i in $LIST > do > booger -start_date $i > done We expect a start day and a day 6 days later than that! The start day is 09/20/2008 and the end day is 09/26/2008 We expect a start day and a day 6 days later than that! The start day is 01/01/2009 and the end day is 01/07/2009 We expect a start day and a day 6 days later than that! The start day is 11/03/2008 and the end day is 11/09/2008 We expect a start day and a day 6 days later than that! The start day is 06/06/2006 and the end day is 06/12/2006 We expect a start day and a day 6 days later than that! The start day is 11/01/2008 and the end day is 11/06/2008 We expect a start day and a day 6 days later than that! The start day is 11/01/2008 and the end day is 11/06/2008 We expect a start day and a day 6 days later than that! The start day is 10/01/2008 and the end day is 10/07/2008