develooper Front page | perl.perl6.compiler | Postings from April 2005

[Pugs] Simple list of lists: Pugs confounded me

Thread Next
From:
Andrew Savige
Date:
April 8, 2005 03:44
Subject:
[Pugs] Simple list of lists: Pugs confounded me
Message ID:
20050408104354.22845.qmail@web50809.mail.yahoo.com
I'd like to convert the following p5 code to p6:

my @z = (
    [ 'a1', 'a2' ],
    [ 'b1', 'b2', 'b3' ]
);
for my $r (@z) { print "@$r\n" }

I thought this might do the trick [1]:

my @z = (
    [ 'a1', 'a2' ],
    [ 'b1', 'b2', 'b3' ]
);
for @z -> $r { say $r }

However, the p5 version prints:

a1 a2
b1 b2 b3

while the pugs p6 version prints:

a1
a2
b1
b2
b3

Is this a Pugs bug? If not, can anyone suggest a legitimate p6 version?

/-\

[1] Suggested by stvn at http://www.perlmonks.org/?node_id=445339


Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About