in reply to Re: Better way to write these checks?in thread Better way to write these checks?
For more general advice on how to refactor code like that, read Higher-Order Perl.
particularly Chapter 5: From Recursion to Iterators