On Wed, Jul 11, 2012 at 11:02 AM, Moritz Lenz <mor...@faui2k3.org> wrote: > Am 11.07.2012 09:55, schrieb Gabor Szabo: > >> I wonder if the first one is a bug: >> >> >> use v6; >> my @x = ( >> { a => 1} >> {b => 2 } >> ); >> say @x.perl; >> >> prints Array.new({"b" => 2}) > > > This is actually correct. It parses as > > > my @x = ( {a => 1}; {b => 2} ); > > Which is roughly the same as > > my @x = ( do { {a => 1}; {b => 2} }); > > In general, a semicolon can be omitted after a closing bracket before the > end of the line. That's why you don't need a semicolon after > > if $condition { > say 'something'; > > } > > >> Almost the same code: >> >> use v6; >> my @x = ( >> { a => 1} {b => 2 } >> ); >> say @x.perl; >> >> ===SORRY!=== >> Malformed initializer > > > Niezca has a better error message: > > Unexpected block in infix position (two terms in a row, or previous > statement missing semicolon?)
Thanks for the explanation. This means the newline matters. Gabor