As you can see, I am hardly consistent.So? Perl isn't consistent in this aspect either, and I think, rightly so. What to do in scalar vs list context is something you should decide on a case by case basis, IMO. So, my answer to
Therefore I am interested in which of the above (or other variations of your choice) people think is a good default behaviour to standardize on..and more importantly why.is that I think standardizing is the wrong thing to do.
Why the test on the number of arguments, and the recursion? Wouldn't the following be equivalent?:# And for something completely different... sub foo { if (1 != @_) { return map $foo($_), @_; } # body of foo here. return $whatever; }
sub foo { map { # body of foo here. $whatever } @_ }
Abigail
In reply to Re: What should be returned in scalar context?
by Abigail-II
in thread What should be returned in scalar context?
by tilly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |