"wantarray" is really a misnomer. It should be called "wantlist" because what it determines is if the calling context is list, scalar, or void.
You're looking for Contextual::Return.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?