what is a good translation of the following C into perl6?

<code>
#include <stdio.h>

void print(int y[])
{
   int ii;

   for (ii = 0; 9 > ii; ++ii)
   {
      printf("%d ", y[ii]);
   }

   printf("\n");
}

int main()
{
   int x = 0; int y[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; y[x++]++; /* line
that matters */

   printf("%d\n", x);
   print(y);

   return 0;
}
</code>

in perl5, i would've written something like:

<code>
my $x = 0; my @y = 1..9; @y[$x++]++; print "$x\n"; print "@y\n"
</code>

but in perl6, the '@' sigil always means list context, so should i
write the following?

<code>
my $x = 0; my @y = 1..9; [EMAIL PROTECTED]; print "$x\n"; print "@y\n"
</code>

-xgl

Reply via email to