use Date::Calc qw( Days_in_Month ); print Days_in_Month(2016,2);