is what if $b contains:
my $b = " 5 ";
Well, the OP explicity stated that she "would like to make sure $b has to be a digit and the digit has to be from 1 to 5". Indeed if you have different requirements and prefer to sanitize the input by removing whitespace, then you can happily do so. Your additional s is perfectly fine, in fact.
In reply to Re^8: Quicker way to do this IF statement 1-5
by blazar
in thread Quicker way to do this IF statement 1-5
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |