use Types::Standard qw( Int ); if ( not Int->check($var) ) { die "It's supposed to be an integer!\n"; }