in reply to Date function

if ($month == 1||3||5||7||8||10||12)
That probably doesn't do what you think it does. I believe you meant:
if ($month == 1 || $month == 3 || $month == 5 etc...

Replies are listed 'Best First'.
Re^2: Date function
by Anonymous Monk on Aug 02, 2013 at 16:15 UTC
    Yes, that would help. Is there any way to compact the code so that it has fewer characters? Also, I am still getting the output for  $mday to be 31. This means that it is interpreting  if ($mday == 0) as true. However since today is the 2nd and the previous day was the 1st; this should be false.
      Is there any way to compact the code so that it has fewer characters?
      Use a hash. Or one of the date modules, like Date::Simple
      use warnings; use strict; use Date::Simple qw(today); print 'today = ', today(), "\n"; print 'yesterday = ', today() - 1, "\n"; __END__ today = 2013-08-02 yesterday = 2013-08-01
        Thank you for all your help!
      if (grep { $month == $_ } (1,3,5,7,8,10,12)) {