On Thu, Jul 29, 2010 at 7:52 PM, Jonathan Worthington
<jonat...@jnthn.net> wrote:
> Note that grep doesn't have to take a closure, but can also take just the
> value you're looking for...
>
>> my @x = 1,2,3; say ?...@x.grep(2); say ?...@x.grep(4);
> 1
> 0

Hm.  could have sworn I'd tried that and it didn't work.

> Though more efficient would be:
>
>> my @x = 1,2,3; say ?...@x.first(2); say ?...@x.first(4);
> 1
> 0

Ah, perfect.  Thanks!

> I still prefer the junction way though. :-)

I love junctions, but it feels like overkill to use them for this. :)

-- 
Mark J. Reed <markjr...@gmail.com>

Reply via email to