Thanx in advance
Welcome to WW.
One way to do it would be to use the time() function to get the number of seconds since 1970 (this is epoch time - used by some scripting languages).
You could then work out the number of seconds in a day, multiply by 31 (yesterday is -1, -30 = 31), then I think you could use localtime() to format the result.
But you'll have to check the documentation for the specifics unless someone else round here knows it off the top of ther head.
Hope that helps.
What you want can be done as simply as:
use DateTime; my $dt = DateTime->now->subtract(days => 31); print $dt->dmy, "\n"; #the date in dd-mm-yyyy format my $year = $dt->year; my $month = $dt->month; my $day = $dt->day;