On Nov 22, [EMAIL PROTECTED] said:

>Does anyone know how to get the last six months into an array?

  my @mon = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );

>my $month = (split ' ', uc localtime)[1];
>to get the current month and now i want to get the previous 5 months, is
>there any way to perform arithmetic on the month value!??

Don't get the month NAME.  Get the month NUMBER:

  my $mon = (localtime)[4];
  my @last_six_months = @mon[($mon-5) .. $mon];

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to