in reply to How much can a function know about the context in which it is called?

Certainly. The unfortunately named wantarray function can tell you:

Returns true if the context of the currently executing subroutine or eval() block is looking for a list value. Returns false if the context is looking for a scalar. Returns the undefined value if the context is looking for no value (void context).
  • Comment on Re: How much can a function know about the context in which it is called?