On 2020-11-13 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( $Leafpadrc, $Line ~ "\n", 
> :append ); }
> 
> If I spurt the array, it converts the array into a
> single text line.

Some alternatives:

  $Leafpadrc.spurt(@LeafpadrcNew.join($Leafpadrc.nl-out));

  $Leafpadrc.put($_) for @LeafpadrcNew;

-- 
        Dakkar - <Mobilis in mobile>
        GPG public key fingerprint = A071 E618 DD2C 5901 9574
                                     6FE2 40EA 9883 7519 3F88
                            key id = 0x75193F88

Reply via email to