http://www.perlmonks.org?node_id=227245


in reply to Re: Context aware functions - best practices?
in thread Context aware functions - best practices?

Very good point. I hadn't considered the lack of values case - what struck me immediately (the first time I was about to write such code, even) about at that snippet was the opposite case: if foo has several values you get extraneous key/value pairs - oops. So I have to agree that it's easy to create confusing semantics with wantarray.

At this point I am confident about my choice for this particular case, and reassured about the fact I hadn't overlooked any caveats myself. Thanks and ++ to everyone for their arguments and for pointing out some implications that escaped me.

Makeshifts last the longest.

  • Comment on Re^2: Context aware functions - best practices?