On 27-12-2010 21:46:05, Daniel Carrera 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? Yes. In Perl 6 (a ? b : c) became (a ?? b !! c)
Regards, Ted