Skip to content

Instantly share code, notes, and snippets.

@theory
Created January 11, 2010 19:24
Show Gist options
  • Save theory/274504 to your computer and use it in GitHub Desktop.
Save theory/274504 to your computer and use it in GitHub Desktop.
my @last_days = (
undef,
sub { 31 },
sub { my $y = shift; return $y % 4 or not ($y % 100) 28 : 29 },
sub { 31 },
sub { 30 },
sub { 31 },
sub { 30 },
sub { 31 },
sub { 31 },
sub { 30 },
sub { 31 },
sub { 30 },
sub { 31 },
);
my $last_day = $last_days[$month]->($year);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment