use Perl6::Slurp; #<= only handles input at present use File::Slurp; # permits writing. # and then.... .... $text = slurp($file); $text =~ s/$this/$that/smg; ... with renaming here ? (see above). write_file($file, $text);