On Mon, Apr 10, 2006 at 14:25:35 -0700, Larry Wall wrote:
> : my $x = grep { ... } @list; # returns count
>
> I think that's already "whatever context". $x contains the resulting array.
> It's only if you later say +$x that you'll get the number of elems.
Just for grep or for any function?
On Sun, Apr 09, 2006 at 02:43:16PM +0300, Yuval Kogman wrote:
: Hi...
:
: I think that Perl 6 should have a "whatever" context, which is
: essentially:
:
: I want either array or scalar or whatever... You choose
:
: so that functions like grep can return an array in "whatever"
: context. T
Hi...
I think that Perl 6 should have a "whatever" context, which is
essentially:
I want either array or scalar or whatever... You choose
so that functions like grep can return an array in "whatever"
context. This is best demonstrated using an example:
my $x = grep { ... } @list