in reply to context of printf ->wantarray
The arguments of a function are evaluated before the function is called. So in the case of printf $format, subroutine() the call to subroutine() is carried out before printf even had a chance to examine the $format argument. So even if it had a mechanism for signalling how many more arguments it needs, it would be too late for that. Instead it just always takes a list of arguments.
So I suggest you try to find a different design that isn't based so heavily on introspection.
|
|---|