in reply to Re^2: Returning undef: The point I would like Damian to reconsider
in thread Returning undef: The point I would like Damian to reconsider
then it should always return a "list", even in scalar context, i.e. if called in scalar context return the last value in its return expression.Ugh, that's not possible. You cannot return a list in a scalar context. Ever.
You can type:
But that's not "returning a list in a scalar context", even if called in a scalar context. It's returning a scalar in a scalar context, by evaluating that comma-expression in a scalar context, getting the result 101.return (99, 100, 101);
I know you know that, but sloppy language here gets us running around in circles.
See my On Scalar Context for samples of many things that "listy" things do in a scalar context. Based on that, I don't see how "last thing" is any more intuitive than "first thing" or "number of elements" (the three main candidates).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Returning undef: The point I would like Damian to reconsider
by jdporter (Paladin) on Jun 23, 2007 at 00:46 UTC | |
by tye (Sage) on Jun 23, 2007 at 01:02 UTC | |
by jdporter (Paladin) on Jun 23, 2007 at 18:53 UTC | |
by tye (Sage) on Jun 24, 2007 at 00:41 UTC | |
by tye (Sage) on Jun 24, 2007 at 03:15 UTC |