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

Re^2: How preparing the weekly shift roster led to a fascinating discovery...

by ciderpunx (Vicar)
on Dec 14, 2007 at 18:45 UTC ( [id://657095]=note: print w/replies, xml ) Need Help??


in reply to Re: How preparing the weekly shift roster led to a fascinating discovery...
in thread How preparing the weekly shift roster led to a fascinating discovery...

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.
  • Comment on Re^2: How preparing the weekly shift roster led to a fascinating discovery...
  • Download Code

Log In?
Username:
Password:

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

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

    No recent polls found