in reply to Type casting

Check your WHERE clause again. Your complaint is that Perl interprets the year as a string. In fact you are forcing the issue by putting the value in quotes.

If it is a number in the db, proper sql requires that the value be unquoted, although some RDBMS implementations can handle this type of conversion.