On Sat, Nov 14, 2020 at 9:02 PM ToddAndMargo via perl6-users <
[email protected]> wrote:
> > Maybe this is what you want:
> >
> > my @a = 1,2,3;
> > spurt('test', @a.join("\n") ~ "\n"); # join doesn't add the last "\n"
> >
> > Or the equivalent
> >
> > 'test'.IO.spurt: @a.join("\n") ~ "\n";
>
> That is the way around the issue.
>
> But my question is why can I not put the \n in the variable?
>
What do you mean by putting the \n in the variable?
Is it anything like this? [¹]
my @a = "1\n", "2\n", "3\n";
'test'.IO.spurt(@a);
or this?
my @a = <a b c>;
'test'.IO.spurt(@a »~» "\n");
[¹] Mind that the array is first converted into a string and its elements
are joined together with an interleaving space
--
Fernando Santagata