if($input =~ /[^1-9]/){ # Used to check for input words. ... } if($input =~ /[1-9]/){ print "\n"; } #### if($input =~ /[^1-9]/){ # Used to check for input words. ... } else { print "\n"; }