in reply to Quicker way to do this IF statement 1-5

First up note that the condition (as stated) is satisfied for some values of $b that are not digits in the range 1 to 5. For example the numbers 2.0, 3e0, 4.0e0, and the string '5anything' will all satisfy the condition. If you really want to ensure that $b is a single digit in the range 1 to 5, then I think the following may suffice -given that the value comes from a form, and is therefore presumably being assigned to $b as a string, not a number:
if (length($b)== 1 && $b >= 1 && $b <= 5) { print "\$b has to be a number and is either 1, 2, 3, 4, or 5."; }
But if $b were to be assigned the number 4.0e0, rather than the string '4.0e0', you would find it still satisifed the condition (as rewritten by me).

On the other hand, if all you want to do is use the numeric value of whatever it is that the user supplied, then I can't really think of any improvement you could make on your original if() statement.

Cheers,
Rob
Update: Replaced length($b == 1) with length($b) == 1 ... smart move, methinks :-)