Thank you for the report, however, this is not a bug.

Closing curlies ('}') end statements when they're the last 
non-whitespace/non-unspace character on the line, which is why your first 
version works.

When putting them all on one line, you have to explicitly specify where the 
statements end,
so when * < 0 {  say "Negative"; }; when * > 0 {  say "Positive"; }; default { 
say "Zero"; } will work just fine.

Cheers,
ZZ


On Tue Sep 20 08:02:39 2016, brasfield.la...@gmail.com wrote:
> Using Rakudo Star:
> ~$ perl6 -version
> This is Rakudo version 2016.07.1 built on MoarVM version 2016.07
> implementing Perl 6.c.
> 
> With a script, try.pl, containing this text:
> given prompt "Enter a number: " {
>  when * < 0 {  say "Negative"; }
>  when * > 0 {  say "Positive"; }
>  default {  say "Zero"; }
> }
> , I get results precisely as expected. (It compiles, prompts, classifies
> its input.)
> 
> But if the script is changed, only by replacing some newline~space
> sequences with space:
> given prompt "Enter a number: " {
>  when * < 0 {  say "Negative"; } when * > 0 {  say "Positive"; } default {
> say "Zero"; }
> }
> then an error message issues:
> ~$ perl6 try.pl
> ===SORRY!=== Error while compiling /home/larry/try.pl
> Strange text after block (missing semicolon or comma?)
> at /home/larry/try.pl:8
> ------>  when * < 0 {  say "Negative"; }⏏ when * > 0 {  say "Positive"; }
> default
> , which I expect to give the same result as before since Perl6 is not a
> line-oriented language (excepting a certain literal construct.)
> 
> For convenience, I attach the file I used to demonstrate this bug. I
> discovered it when trying an example which I converted to a one-liner in an
> interactive REPL session.
> 
> Best regards,



Reply via email to