Re: scalar/array contexts in perl5 vs. perl6

2005-12-05 Thread Jonathan Scott Duff
On Sun, Dec 04, 2005 at 01:10:44PM -0500, Mike Li wrote: what is a good translation of the following C into perl6? [snip] 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

scalar/array contexts in perl5 vs. perl6

2005-12-04 Thread Mike Li
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

Re: scalar/array contexts in perl5 vs. perl6

2005-12-04 Thread Juerd
Mike Li skribis 2005-12-04 13:10 (-0500): in perl5, i would've written something like: my $x = 0; my @y = 1..9; @y[$x++]++; print $x\n; print @y\n but in perl6, the '@' sigil always means list context, so should i write the following? my $x = 0; my @y = 1..9; [EMAIL PROTECTED]; print

Re: scalar/array contexts in perl5 vs. perl6

2005-12-04 Thread Sam Vilain
On Sun, 2005-12-04 at 13:10 -0500, Mike Li wrote: what is a good translation of the following C into perl6? code [...] int x = 0; int y[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; y[x++]++; /* line that matters */ [...] /code in perl5, i would've written something like: code my $x = 0; my @y =