in reply to Confused Contexts and wantarray
The routine doesn't do a thing except force a list context on link and scalarize its return value. But having it there also makes clear what's intended.my $n = size($obj->link('next')); sub size {scalar @_}
<heretical rant>
In my mind size ought to have been a built-in function, rather than relying solely on implied semantics and contextual hocus-pocus to do its job. The number of newbies who try to use length for this purpose is, by itself, testament to an unmet need.
</heretical rant>
And just think of all the questions in SoPW that might've been eliminated!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Confused Contexts and wantarray
by ysth (Canon) on Jan 18, 2005 at 07:34 UTC | |
|
Re^2: Confused Contexts and wantarray
by duff (Parson) on Jan 18, 2005 at 06:00 UTC |