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 context, 

Um ... do you mean s/perl6/perl5/ above?  In perl6 the @ sigil does
not always mean list context; it just means that you're dealing with
an array somehow.

Your code above is practically perl6 already.  The only problem with
it that I see is that you need to use @y[] to interpolate an array
into a string:

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

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to