On 10 Sep 2002, Aaron Sherman wrote:
>
> Here's my latest bug, which I will work on tracking down. It's a pretty
> huge blocker for everything I've been working on, so there's no sense in
> spending my time elsewhere:
>
>     sub def ($arg) {
>             return $arg;
>     }
>     $o = 25;
>     $q = def($o);
>     die "Why is return value $q?" unless $q == $o;
>
> The problem seems to be that any numeric argument is converted to 1 (is
> that a list length?)

Correct.  List/scalar context is done at compile time, so all subs return
lists -- there is no "wantarray".  I believe "($q) = def($o)" will work,
but I should probably fix that to put the last returned value in the
result if the function returns to a scalar.  Or look at the "return"
statement, figure out whether it looks like a scalar, array, or
tuple/list, and use the existing logic for assigning between these things.

/s

Reply via email to