sub archive1 { use warnings; use 5.011; use Path::Tiny; my $path1 = Path::Tiny->cwd; say "path1 is $path1"; my $parent1 = $path1->parent(); say "parent2 is $parent1"; my $file1 = "1.manifest"; my $from = path( $parent1, $file1 ); my @files = $from->lines_utf8; say "files are @files"; my $tempdir = Path::Tiny->tempdir('backup_XXXXXX'); say "temp dir is $tempdir"; my $readme = $tempdir->child( 'grandfather', 'README.txt' )->touchpath; say "read me is $readme"; my $grand_dir = $readme->parent; chdir $grand_dir; foreach my $file (@files) { #syntax is from -> to my $return = path( $parent1, $file )->copy( $grand_dir, $file ); if ( $file =~ m/\.(pl|sh)$/ ) { $return->chmod(0755); } say "return is $return"; } system("cd $grand_dir"); system("ls -l"); my $b = "dummy"; return $b; }