On Mon, Dec 27, 2010 at 15:46, Daniel Carrera <dcarr...@gmail.com> wrote:
> Hello,
>
> Looking at the first example in "Using Perl6", I have:
>
> if $r1 > $r2 {
>    %matches{$p1}++;
> } else {
>    %matches{$p2}++;
> }
>
> I was thinking that it should be possible to make this more compact, but the
> two ideas I tried didn't work:
>
> # Idea 1 gives: Unable to parse postcircumfix:sym<{ }>, couldn't find final
> '}'
> %matches{  $r1 > $r2 ? $p1 : $p2 }++;
>
> # Idea 2 gives: Unable to parse blockoid, couldn't find final '}'
> $r1 > $r2 ? { %matches{$p1}++ } : { %matches{$p2}++ };
>
>
> Is there a way to make something along these lines work?
>
> Daniel.
> --
> No trees were destroyed in the generation of this email, but a large number
> of electrons were severely inconvenienced.
>

The [conditional operator][1] is now spelled test ?? true !! false not
test ? true : false.

 [1] : http://perlcabal.org/syn/S03.html#Conditional_operator_precedence

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

Reply via email to