in reply to Guess That Number
if ($answer !~ /\d+/) {I think the following code better represents your intent:
if ($answer =~ /\D/) {
You only want someone to enter a positive integer. You don't want someone entering a number with letters or other characters in it, such as '123g'. This string slips through your regex test, then generates unnecessary warnings.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Guess That Number
by naildownx (Beadle) on Jul 09, 2009 at 19:38 UTC | |
by toolic (Bishop) on Jul 09, 2009 at 20:09 UTC |