use Date::Simple qw(days_in_month); my $days = days_in_month( 2004, 2 );