in reply to Re: Re: What should be returned in scalar context?
in thread What should be returned in scalar context?
I am saying that I as a programmer need to make this choice fairly often, what choices should I tend to make, and why?
You use wantarray that much? I've used it less than a couple of handfuls of times in the 11+ years I've been using perl. Most of the time I write subroutines that return lists, I say that's what they do. Period. It's rare that I need different functionality depending on context. It's only when I think "it sure would be nice if this routine did this sometimes and that other times" that wantarray might come into the picture. And when that happens, I've already decided what I need from scalar, list and void contexts. (I don't usually care about void context though)
|
|---|