If it is okay to have a temporary copy of the entire file in memory:
spurt "output.txt", slurp "input.txt";
Otherwise, copying line-by line:
my $in = open "input.txt"; my $out = open "output.txt", :w; for $in.lines -> $line { $out.say: $line; } $in.close; $out.close;
Last updated 1 year ago