in reply to Re^6: Use of wantarray Considered Harmful
in thread Use of wantarray Considered Harmful
What I meant by that was that the subroutine should always return the same information - changing context should be lossless. Hence, an array vs. an iterator (or an arrayref). But, not an array vs. the first element.
My criteria for good software:
As for your examples: localtime does array vs. joined array. That's on the border of acceptable. The diamond operator and readline are lossless - they are their own iterators (which is another rant for another day). m//g always returns a list - what you do with that list is your decision.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
In Section
Meditations