in reply to Re: Maintaining context of the caller
in thread Maintaining context of the caller

That's not so great. If scalar context is going to be used, then you're using unnecessarilly wasteful operations. Store the result in a scalar and return the scalar. Don't store into an array, construct a list of indexes, and return a list slice.

Then again, I'm just against wasting resources on something so trivial. I write my code to call wantarray() multiple times because I know that's cheaper (it should be, anyway) than dealing with all that listy business.

  • Comment on Re^2: Maintaining context of the caller

Replies are listed 'Best First'.
Re^3: Maintaining context of the caller
by revdiablo (Prior) on Jul 04, 2005 at 23:29 UTC

    The aesthetical "correctness" of code will vary depending on one's point of view, but I think your concerns stem more from my question than ikegami's answer. I asked for a way to avoid duplicating the context-checking logic, and he provided it. I happen to think his is a very nice solution, but of course reasonable folks can disagree.