http://www.perlmonks.org?node_id=96385


in reply to Re: Re: Nicer If...
in thread Nicer If...

You need code tags so your [0] shows up...

Actually I like runrig's solution better than mine, it still goes through all the options, but it can be very simply tweaked to return which fields were empty, which is quite useful in this case. Your way will work, but since the calls for the data are retrieved via methods, and not a data structure, your way still has to call them all to be successful. You could do it otherwise, but then you would lose genericity. For something like this I prefer either a few lines of code in the prog, or a sub like yours that you pass params and a list of fields, but as I said, its not so generic any more....

                - Ant