Im working on a project of my own, I need to be able to easy get the last week/month, this is because I need to do some calculations between this month and the last one. Haven't found an easy way of doing this. I would like to have it like this:

Maybe you should specify that this function is available by loading specific CPAN modules such as Date::Calc and/or possibly others. There is a wealth of such modules to do all kind of data and time calculations, the difficulty is not to find one, but more to find the most appropriate one for your needs.