if ( $number =~ m/^\d+$/ and $number != 1 ) { # do stuff } else { die "There can be only 1!" }