On 2020-11-14 03:15, Tom Browder wrote:
On Sat, Nov 14, 2020 at 01:59 ToddAndMargo via perl6-users <perl6-us...@perl.org <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( $Leafpadrc );
         for @LeafpadrcNew -> $Line  { spurt( $Leafpadrc, $Line ~ "\n",
    :append ); }


Unless I misunderstand, why doesn't this work:
     my $fh = open $Leafpadrc, :w;
     $fh.say($_) for @Leafpadrc;
-Tom



   unlink( $Leafpadrc );
   $Leafpadrc.IO.open( :w );

Neither of these two actually updates the file.

   for @LeafpadrcNew -> $Line  { put( $Leafpadrc, $Line ); }
   for @LeafpadrcNew -> $Line  { $Leafpadrc.put( $Line ); }

Reply via email to