Re: spurt and array question

2020-11-15 Thread ToddAndMargo via perl6-users
On 2020-11-14 23:56, Fernando Santagata wrote: Oh, now I see: you were asking that question in another thread. I was asking why the \n came out literal in another thread. It did not help I made a syntax boobo. I never got the other ways of writing out the array to work either.

Re: spurt and array question

2020-11-14 Thread Fernando Santagata
Oh, now I see: you were asking that question in another thread. <<>> is equivalent to qq:ww:v as mentioned here: https://docs.raku.org/syntax/%3C%3C%20%3E%3E#index-entry-%3Aval_%28quoting_adverb%29 and as stated here: https://docs.raku.org/language/quoting the adverb :ww splits the string into

Re: spurt and array question

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-14 13:39, Fernando Santagata wrote: What do you mean by putting the \n in the variable? $ p6 'my @x = <>; for @x {"$_".print};' aaabbbccc Why are the \n's not being resolved in the above? Why do I have to add an \n to the print line? $ p6 'my @x = <>; for @x {"$_\n".print};' aaa

Re: spurt and array question

2020-11-14 Thread Fernando Santagata
On Sat, Nov 14, 2020 at 9:02 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> 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"; >

Re: spurt and array question

2020-11-14 Thread ToddAndMargo via perl6-users
On Sat, Nov 14, 2020 at 1:07 PM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: On 2020-11-14 06:00, Brad Gilbert wrote: > The purpose of `spurt` is to: > 1. open a NEW file to write to > 2. print a single string > 3. close the file > > If you

Re: spurt and array question

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-14 11:22, Fernando Santagata wrote: On Sat, Nov 14, 2020 at 8:07 PM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: On 2020-11-14 06:00, Brad Gilbert wrote: > The purpose of `spurt` is to: > 1. open a NEW file to write to > 2. print a single

Re: spurt and array question

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-14 03:15, Tom Browder wrote: On Sat, Nov 14, 2020 at 01:59 ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: Hi All, I am writing out an array of text lines to a file. I just can't help but thinking I am doing it the hard way.     unlink(

Re: spurt and array question

2020-11-14 Thread Brad Gilbert
Actually no I'm not “forgetting that spurt comes with an `:append` option”. That is a slightly different use case. It is where you are appending to an existing file once, and then never touching it again. (Or maybe you might be touching it again in a few hours.) --- Given that this is what you

Re: spurt and array question

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-14 03:59, Gianni Ceccarelli wrote: $Leafpadrc.put($_) for @LeafpadrcNew; Cannot resolve caller print(Str:D: BOOTStr); none of these signatures match: (Mu: *%_) in sub RunReport at ./XferParts.pl6 line 229 229: $Leafpadrc.put($_) for @LeafpadrcNew; --

Re: spurt and array question

2020-11-14 Thread Fernando Santagata
On Sat, Nov 14, 2020 at 8:07 PM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > On 2020-11-14 06:00, Brad Gilbert wrote: > > The purpose of `spurt` is to: > > 1. open a NEW file to write to > > 2. print a single string > > 3. close the file > > > > If you are calling `spurt` more

Re: spurt and array question

2020-11-14 Thread ToddAndMargo via perl6-users
On 2020-11-14 06:00, Brad Gilbert wrote: The purpose of `spurt` is to: 1. open a NEW file to write to 2. print a single string 3. close the file If you are calling `spurt` more than once on a given file, you are doing it wrong. You are forgetting that spurt comes with an `:append` option.

Re: spurt and array question

2020-11-14 Thread Brad Gilbert
The purpose of `spurt` is to: 1. open a NEW file to write to 2. print a single string 3. close the file If you are calling `spurt` more than once on a given file, you are doing it wrong. If you give `spurt` an array, you are probably doing it wrong; unless you want the array turned into a single

Re: spurt and array question

2020-11-14 Thread Gianni Ceccarelli
On 2020-11-13 ToddAndMargo via perl6-users wrote: > Hi All, > > I am writing out an array of text lines to a file. > I just can't help but thinking I am doing it the > hard way. > > unlink( $Leafpadrc ); > for @LeafpadrcNew -> $Line { spurt( $Leafpadrc, $Line ~ "\n", > :append ); } >

Re: spurt and array question

2020-11-14 Thread Tom Browder
On Sat, Nov 14, 2020 at 01:59 ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > I am writing out an array of text lines to a file. > I just can't help but thinking I am doing it the > hard way. > > unlink( $Leafpadrc ); > for @LeafpadrcNew -> $Line { spurt(