Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Date function

by toolic (Bishop)
on Aug 02, 2013 at 15:59 UTC ( [id://1047616]=note: print w/replies, xml ) Need Help??


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)) {

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1047616]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-03-28 15:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found