#!/usr/bin/perl -w use strict; use 5.010; use Path::Tiny; use utf8; # creating Path::Tiny objects my $dir = path("/home/bob"); my $name = "1.promises.txt"; my $new_name = path($dir,"1.revised.txt"); my $path1 = path($dir, $name); # list say $path1; my $path2 = path("."); say $path2; # cwd my $path3 = path("~user/file.txt"); # tilde processing say $path3; #say "lines are @lines"; my @lines = $path1->lines_utf8; foreach my $i (0 .. $#lines) { say "i is $i"; say "$lines[$i]"; $lines[$i] =~ s/God/an arbitrary higher power/; $lines[$i]=~ s/Бог/большая сила/; } $new_name->spew_utf8( @lines ); __END__