in reply to How do I restrict a variable to a range of values?

There are modules for restricting scalars via tie-ing e.g. Tie::Assert and Tie::Constrained.
  • Comment on Re: How do I restrict a variable to a range of values?