Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: What is the best way to get a list of all Mondays until the end of the year?

by BrowserUk (Patriarch)
on Aug 19, 2008 at 17:47 UTC ( [id://705283]=note: print w/replies, xml ) Need Help??


in reply to What is the best way to get a list of all Mondays until the end of the year?

[0] Perl> $t = time(); while( $_=localtime( $t ) and m[2008] ) { m[^Mon] and print scalar localtime( $t ); $t+=86400; } Mon Aug 25 18:45:13 2008 Mon Sep 1 18:45:13 2008 Mon Sep 8 18:45:13 2008 Mon Sep 15 18:45:13 2008 Mon Sep 22 18:45:13 2008 Mon Sep 29 18:45:13 2008 Mon Oct 6 18:45:13 2008 Mon Oct 13 18:45:13 2008 Mon Oct 20 18:45:13 2008 Mon Oct 27 17:45:13 2008 Mon Nov 3 17:45:13 2008 Mon Nov 10 17:45:13 2008 Mon Nov 17 17:45:13 2008 Mon Nov 24 17:45:13 2008 Mon Dec 1 17:45:13 2008 Mon Dec 8 17:45:13 2008 Mon Dec 15 17:45:13 2008 Mon Dec 22 17:45:13 2008 Mon Dec 29 17:45:13 2008

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: What is the best way to get a list of all Mondays until the end of the year?
  • Download Code

Replies are listed 'Best First'.
Re^2: What is the best way to get a list of all Mondays until the end of the year?
by Rhandom (Curate) on Aug 19, 2008 at 19:28 UTC
    ++

    I had one that was equivalent in length to my other code post that did the same thing (just looked at every day) - but I thought I'd avoid doing the extra un-needed calculations by going a week at a time. But most use cases probably wouldn't care about the extra 300 (at most) iterations.
    my @a=qw(random brilliant braindead); print $a[rand(@a)];

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-26 06:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found