On Mon, Jan 29, 2007 at 10:01:08PM +0200, Gaal Yahas wrote:
> > +Because C<gather> evaluates its block or statement in void context,
> > +this typically causes the C<take> statement to be evaluated in void
> > +context. However, a C<take> statement that is not in void context
> > +gathers its arguments I<en passant> and also returns them unchanged.
> > +This makes it easy to keep track of what you last "took":
> > +
> > + my @uniq = gather for @list {
> > + state $previous = take $_;
> > + next if $_ === $previous;
> > + $previous = take $_;
> > + }
>
> What does it mean for take to be evaluated in void context?
>
> What are the gathered values here?
>
> take 1, 2; # easy. flattened 1 and then 2, right?
> @x = take 1, 2; # same thing?
> $x = take 1, 2; # same thing? [1, 2]?
In fact, $x = take 5; # if this were Perl 5, I might expect
# either 1 or [1] here!
--
Gaal Yahas <[EMAIL PROTECTED]>
http://gaal.livejournal.com/