sub is_odd { my $int = shift; if ( $int =~ /\D/ ) { die "Not an integer, dummy!" } substr($int,-1) =~ /[13579]/; }