To me, it depends A LOT on what the function is being used for. The inconsistency within built in perl functions demonstrates this sort of dwimmery in action.
I tend to prefer the second option, though (return wantarray ? @ret : \@ret;) because I don't like the idea of discarding any data when scalar context is forced. The reference still behaves nicely in boolean context, but it contains all the information of the original array."
In reply to Re: What should be returned in scalar context?
by jweed
in thread What should be returned in scalar context?
by tilly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |