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";
    }