The <…> and «…» constructors break on whitespace. So <a,b,c,d,e,f> will actually produce the following array:
["a,b,c,d,e,f"] It's only one item. If we placed space after the comma, that is, <a, b, c, d, e, f>, you'd get a six item list, but with the commas attached to all but the final: ["a,", "b,", "c,", "d,", "e,", "f"] By replacing the commas with spaces, e.g., <a b c d e f>, you allow it to break into ["a", "b", "c", "d", "e", "f"] Matéu > On Nov 14, 2020, at 14:12, ToddAndMargo via perl6-users > <perl6-us...@perl.org> wrote: > > On 2020-11-14 11:08, Curt Tilmes wrote: >> On Sat, Nov 14, 2020 at 2:03 PM ToddAndMargo via perl6-users >> <perl6-us...@perl.org> wrote: >>> Just out of curiosity, why is the \n printed out literally here? >>> p6 'my @x = <"aaa\n","bbb\n","ccc\n">; for @x {print @_};' >> Your 'word quoting' <> is sort of like single quotes -- it keeps the >> literal stuff. You could >> use <<>> which is more like double quotes, >> Curt > > or remove the commas. I put everything in [0] > > > $ p6 'my @x = <aaa\n bbb\n ccc\n>; for @x {print "$_\n";}' > aaa\n > bbb\n > ccc\n > > $ p6 'my @x = <<aaa\n bbb\n ccc\n>>; for @x {print "$_\n";}' > aaa > bbb > ccc > > $ p6 'my @x = <<aaa\n bbb\n ccc\n>>; for @x {print "$_";}' > aaabbbccc > > What am I missing? > > -T > > -- > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Computers are like air conditioners. > They malfunction when you open windows > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~