Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Checking for single digit

by Anonymous Monk
on May 06, 2003 at 01:10 UTC ( #255779=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $input = <STDIN>
      if ($input =~ /\d/) {
    ...
      } else {
        print "input wasn't a single digit number\n";
      }
    
  2. or download this
    $input = <STDIN>
      if ($input =~ /[0-9]/) {
    ...
      } else {
        print "input wasn't a single digit number\n";
      }
    
  3. or download this
    my $number;
    chomp ($number = <STDIN>);
    if ($number < 10) {
      print "input was either 0-9 or -\n";
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://255779]
Approved by Paladin
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2018-05-26 10:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?