On Jul 9, Tom Yarrish said:

>I do have one additional question with the suggestion for the @days array.
>How does this affect the month.  Localtime returns the month-1, so I would
>have to adjust for that during the month, and then leave it alone at the
>end of the month.  Or was this a suggestion to replace the if/else part?

Since arrays start at 0, I'd suggest you keep $mon how you get it -- from
0 to 11.  For output, though, you can add one:

  $mon = (localtime)[4];

  print "There are $days[$mon] days in month #", $mon + 1, "\n";
  # There are 31 days in month #7

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **

Reply via email to