Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I guess you could:
#!/usr/bin/perl use strict; use warnings; use Date::Calc qw/Days_in_Month Day_of_Week/; my @days_of_week = qw/NULL Mon Tue Wed Thu Fri Sat Sun/; my $i=0; # Our 14 calendars are in these years, this century # see: http://www.koshko.com/calendar/calendar-lookup-gregorian.shtml for (6, 7, 1, 2, 3, 10, 11, 12, 24, 8, 20, 4, 16, 0) { my $year=$_+2000; $i++; my %days_of_month; for my $month_of_year(1 .. 12) { my $sday = Day_of_Week($year,$month_of_year,1); # only need to cal +l this once for my $day_of_month(1 .. Days_in_Month($year,$month_of_year)) { $sday = 1 if($sday>7); my $dow = $sday++; $days_of_month{$day_of_month}{$dow}++; } } for my $day_of_month (sort keys %days_of_month) { next if(scalar keys %{$days_of_month{$day_of_month}} == 7); my @missing_days; for (1..7) { push (@missing_days, $days_of_week[$_]) if !defined $days_of_mon +th{$day_of_month}{$_}; } print "Calendar $i: In $year, Day $day_of_month does not fall on " +, join(", ", @missing_days), "\n"; } }
--
Linux, perl, punk rock, cider: charlieharvey.org.uk.

In reply to Re^2: How preparing the weekly shift roster led to a fascinating discovery... by ciderpunx
in thread How preparing the weekly shift roster led to a fascinating discovery... by McDarren

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-23 18:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found