Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2018-08-16 05:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (167 votes). Check out past polls.

    Notices?