> > A scalar context C<want> would also need to DWIM, presumably by returning
> > "0, but true" in that (unusual) situation.
>
> Actually, given Damian's and my conversations last night, it looks like
> the first return arg from want() is going to be the context after all
> (since then if's and cases's work correctly).
That's correct.
> And you can now get the number to return by referencing element 1:
>
> if ( ($num_to_return) = (want 'LIST')[1] ) { # '3'
> # do stuff
> }
Or more tidily by treating C<want> as a hashref:
if ( $num_to_return = want->{COUNT} ) {
# do stuff
}
Damian
- Re: Change "($one, $two)=" behavior for optimizati... Nathan Wiger
- Re: Change "($one, $two)=" behavior for optimizati... Damian Conway
- Re: Change "($one, $two)=" behavior for optim... Nathan Wiger
- Re: Change "($one, $two)=" behavior for optim... Damian Conway
- Re: Change "($one, $two)=" behavior for o... Nathan Wiger
- Re: Change "($one, $two)=" behavior for optim... Nathan Wiger
- Re: Change "($one, $two)=" behavior for optim... Graham Barr
- Re: Change "($one, $two)=" behavior for optim... Damian Conway
- Re: Change "($one, $two)=" behavior for o... Nathan Wiger
- Re: Change "($one, $two)=" behavior for o... Bart Lateur
- Damian Conway
