in reply to Re: Date function
in thread Date function

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.

Replies are listed 'Best First'.
Re^3: Date function
by toolic (Bishop) on Aug 02, 2013 at 16:27 UTC
    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!
Re^3: Date function
by Anonymous Monk on Aug 03, 2013 at 06:16 UTC
    if (grep { $month == $_ } (1,3,5,7,8,10,12)) {