Date::Calc
On 6/25/06, ebony smith <[EMAIL PROTECTED]> wrote:
I am new to perl and need to compare some dates in a file stored in dd-mm-yyyy format to find out if the dates are greater than 30, 60 or 90 days. However, I am not quite sure how to go about doing that in perl and I was wondering if anyone out there had any tips on how to do this. I extract the data required using the following to get a date and username if (-e $FILE) { unlink $FILE ;} open (CHK, ">> $FILE") || die "Cannot open $FILE"; system (`awk '/Login/ {print \$1,\$7}' $FILE1 | sort -u >> $FILE1`); Then this gives me the current date $tm = localtime($date); $day = $tm->mday; $month = $tm->mon+1; $year = $tm->year+1900; if ( $day < 10 ){ $day="0$day"; } if ( $month < 10 ){ $month="0$month"; } $querydate = "$year-$month-$day"; return $querydate However I am not too sure how to go about comparing the date extracted from the data file with the current date to find out if it is greater 30, 60 or 90 days. Any help would be appreciated. _________________________________________________________________ Be the first to hear what's new at MSN - sign up to our free newsletters! http://www.msn.co.uk/newsletters -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
-- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>