#!/usr/local/bin/perl5_8 use strict; use warnings; use Time::Local; #snipped stuff #Calculate elapsed months since today my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime; my $mo = $mon + 1; my $dy = $mday; my $yr = $year + 1900; #yep, extra steps but makes it clearer to me... my $now_date = "$yr/$mo/$dy"; my($ny, $nm, $nd) = $now_date =~ m<^(\d+)/(\d+)/(\d+)$>; my $ntime = timelocal(0, 0, 12, $nd, $nm-1, $ny); my $then_date = "1999/06/30"; # rpts will never go back beyond this date my($ty, $tm, $td) = $then_date =~ m<^(\d+)/(\d+)/(\d+)$>; my $ttime = timelocal(0, 0, 12, $td, $tm-1, $ty); my $elapsed_mons = int(($ntime - $ttime)/( 60 * 60 * 24 * 30)); #use $elapsed_mons to generate drop down list of available report months #snipped stuff