($month, $year) = (localtime)[4..5]; # convert from index to 'normal' $this_months_year = $year + 1900; $last_months_year = $this_months_year; $this_month = $month + 1; # fix month if = 0 $last_month = $month; $last_month or $last_month = 12; # roll back year if this month is january ($this_month == 1) and $last_months_year--; $this = sprintf("%04d%02d", $this_months_year, $this_month); $last = sprintf("%04d%02d", $last_months_year, $last_month); @files_this = ; @files_last = ;