Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: how can i find number of days in a given year and month

by grinder (Bishop)
on Jul 16, 2001 at 23:31 UTC ( [id://97148]=note: print w/replies, xml ) Need Help??


in reply to how can i find number of days in a given year and month

#! /usr/bin/perl -w use strict; use Date::Calc qw/Days_in_Month/; while( <DATA> ) { chomp; my( $year, $month ) = split; my $days = eval { Days_in_Month( $year, $month) }; $days = 'who knows?' if $@; print "$year/$month => $days\n"; } __DATA__ 1996 1 1996 2 1998 2 2000 2 1900 2 1600 2 2001 2 2001 7 2001 12 2001 13 2001 0

hint: if you know your data are clean then you can omit the eval and error check.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-26 04:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found