in reply to context of printf ->wantarray

Other advice aside you might check out Contextual::Return and make sure you're not reinventing wheels if you're determined to take this route.

The cake is a lie.
The cake is a lie.
The cake is a lie.