develooper Front page | perl.perl6.language | Postings from April 2005

Re: Quickcheck of context of index expressions

Thread Previous | Thread Next
From:
Larry Wall
Date:
April 29, 2005 06:23
Subject:
Re: Quickcheck of context of index expressions
Message ID:
20050429132257.GA25663@wall.org
On Tue, Apr 26, 2005 at 03:33:44AM +0800, Autrijus Tang wrote:
: Another quick check on expression context for indexed expressions.
: Please sanity-check the return value of want() below:
: 
:     @x[0] = want();   # scalar context

Good.

:     @x[want()] = $_;  # scalar context
:     @x[want()] = @_;  # scalar context

Maybe "unknown" context, which defaults to list.

:     @x[0,] = want();  # list context
:     @x[want(),] = $_; # list context
:     @x[want(),] = @_; # list context
:     $_ = @x[want()];  # scalar context
:     @_ = @x[want()];  # list context

No, I think they're all list context.

Larry

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About