On Mon, Dec 27, 2010 at 16:00, Chas. Owens <chas.ow...@gmail.com> wrote:
> On Mon, Dec 27, 2010 at 15:55, Daniel Carrera <dcarr...@gmail.com> wrote:
>> On Mon, Dec 27, 2010 at 9:49 PM, Chas. Owens <chas.ow...@gmail.com> wrote:
>>>
>>> The [conditional operator][1] is now spelled test ?? true !! false not
>>> test ? true : false.
>>
>> Thanks!
>> Now the following code works:
>> %matches{  $r1 > $r2 ?? $p1 !! $p2 }++;
>>
>> I'm still having trouble with the other alternative:
>> $r1 > $r2 ?? { %matches{$p1}++ } !! { %matches{$p2}++ };
>> Now the problem is that %matches is empty. I'm not sure why. Maybe you can't
>> have code blocks inside ?? ... !! ...
>> Daniel.
>> --
>> No trees were destroyed in the generation of this email, but a large number
>> of electrons were severely inconvenienced.
>>
>
> { } by itself creates a lambda (i.e. an anonymous function), so it may
> be that you are returning an anonymous function that never gets
> executed.  Try using parentheses instead of braces.
>
> --
> Chas. Owens
> wonkden.net
> The most important skill a programmer can have is the ability to read.
>

Or better yet, don't use anything.  Since ++ has higher precedence
than ??!!, it doesn't need to any parentheses:

$r1 > $r2 ?? %matches{$p1}++ !! %matches{$p2}++ ;

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

Reply via email to