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

There's a very cute module called Quantum::Superpositions that will let you do this:
if ($b == any(1, 2, 3, 4, 5)) { print "\$b has to be a number and is either 1, 2, 3, 4, or 5."; }
TMTOWTDI... especially when CPAN gets into the picture!

Update: After rereading the thread and the rest of the replies... maybe the method I gave here is best considered as a curiosity or demonstration of this module's abilities, rather than as a practical solution. Just don't forget about it when you need to solve a more general version of the problem.

~dewey