The question you ask is ambiguous: September 2013 begins on a Saturday and ends the following Sunday ... how many weeks, to you, is that? You might say six, or you might say four. Date-calculation routines are available in abundance on CPAN, but first you must nail-down the exact meaning of the question for you. See for example Date::Calc, Date::Manip for the math heavy-lifting.