in reply to enforcing list context

Try putting another set of brackets around the ternary:

sub value { my ($self) = @_; return ( $self->{first}, ( $self->{rest} ? $self->{rest}->value : () ) ); }

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: enforcing list context
by billh (Pilgrim) on Apr 26, 2006 at 11:11 UTC
    I don't see how that could help, to be honest, the comma operator is still in scalar context.

      Sorry. Having re-read your question, I completely misunderstood the problem. The brackets don't help at all. Using the array seems like the best (only?) option to me.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.