On Wed, Sep 03, 2008 at 03:38:29AM -0700, Pim wrote: > #!/usr/local/bin/pugs -w > > loop (my $i=0;$i<2;$i++) { > say $i; > } > > my $n=7; > if ($n > 2) { say "$n is bigger than 2";} > ------------------ > crashes with this error: > Unexpected "2" > expecting operator or ";" > at ./t3.pl line 9, column 10 > [...] > and per6 parrot compiled (THIS VERSION): > Statement not terminated properly at line 9, near "2) { say \""
If both pugs and rakudo agree on an error, I'd bet that the problem is in the program and not the compiler(s). :-) In this case, the problem is the lack of a space before the angle bracket in the loop statement: loop (my $i=0;$i<2;$i++) { ... if ($n > 2) { say "$n is bigger than 2";} Perl 6 sees the angle bracket following the "$i" as being a subscript using the <...> notation, which ends at the angle bracket in the "if" statement. It then complains about not understanding the "2" that follows the closing angle bracket. S03:2793 notes this explicitly: Note: any operator beginning with C<< < >> must have whitespace in front of it, or it will be interpreted as a hash subscript instead. So, add a whitespace character in front of the opening angle bracket, and all works (at least in rakudo): $ cat x #!/usr/local/bin/pugs -w loop (my $i = 0; $i < 2; $i++) { say $i; } my $n = 7; if ($n > 2) { say "$n is bigger than 2";} $ ./parrot perl6.pbc x 0 1 7 is bigger than 2 Thanks! Pm