On 12/27/2010 09:55 PM, Daniel Carrera 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 ?? ... !! ...
You can have (otherwise you'd get a syntax error), but it's not magically executed. You can write $r1 > $r2 ?? %matches{$p1}++ !! %matches{$p2}++; or %matches{$r1 > $r2 ?? $p1 !! $p2 }++; or my $closure = $r1 > $r2 ?? { %matches{$p1}++ } !! { %matches{$p2}++ }; # invoke it $closure();