in reply to Re^7: Quicker way to do this IF statement 1-5
in thread Quicker way to do this IF statement 1-5

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.