On Thu, Nov 8, 2012 at 11:56 AM, Marco van Kammen <mvankam...@mirabeau.nl>wrote:
> Hi List,**** > > ** ** > > For a logrotation and cleanup script I want to fill the following > variables.**** > > ** ** > > my $current_month = (should be Nov)**** > > my $current_mont_num = (should be 11)**** > > my $previous_month = (should be Oct)**** > > my $previous_month_num = (should be 10)**** > > ** ** > > I’ve been looking at the module Date::Manip to get this going, but I can’t > seem to get it working.**** > > ** ** > > Any help in the right direction would be appreciated.**** > > ** ** > > With Kind Regards,**** > > ** ** > > ** ** > *Marco van Kammen* Applicatiebeheerder *Mirabeau | > Managed Services* Dr. C.J.K. van Aalstweg 8F 301, 1625 NV Hoorn > +31(0)20-5950550 - www.mirabeau.nl [image: Mirabeau] Please > consider the environment before printing this email > > Hi Marco, For this I would nto bother with Date::Manip but just use time. Something like the below would do perfectly fine... my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); my @months = ( 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC' ); my $current_month = $months[$mon]; my $current_mont_num = $mon; my $previous_month = $months[$mon -1]; my $previous_month_num = $mon -1; print "$current_month\n$current_mont_num\n$previous_month\n$previous_month_num\n"; Easy enough and without a module needed a lot more portable without a lot of work. Regards, Rob Coops
<<miralogo69b6.png>>
<<blank4113.gif>>
<<leaf1fbe.gif>>
<<blank20ad.gif>>
<<blank1c63.gif>>
<<blank52fd.gif>>