in reply to What should be returned in scalar context?
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."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: What should be returned in scalar context?
by tilly (Archbishop) on Dec 02, 2003 at 14:59 UTC | |
|
Re: Re: What should be returned in scalar context?
by Anonymous Monk on Dec 02, 2003 at 14:56 UTC |