You can achive this without using external modules:
#!/usr/bin/perl -w
use strict;
use Time::Local;
while( <DATA> ) {
chomp;
my ($year, $month) = split;
do { warn "Invalid month: $month\n"; next }
if $month > 12 or $month < 1;
my $next_year = ($month == 12) ? $year + 1 : $year;
my $next_month = timelocal(0, 0, 0, 1, $month % 12, $next_year);
my $days = (localtime($next_month - 86_400))[3];
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
Update: Small fixes to code as recommended by tye