If you are guaranteed to work in a Unix system (for example, do not care about portability), I will go against my own inclinations and consider best practices and recommend considering the use of "cp" :)
system("cp $PATH1/*.txt $ENV{'DIRWORK'}");
For Perl's own solution, combine the globbed file list (or File :: Find) with File :: Spec the ability to find the actual file name
my @files = glob("$PATH1/*.txt"); foreach my $file (@files) { my ($volume,$directories,$filename) = File::Spec->splitpath( $file ); copy($file, File::Spec->catfile( $ENV{'DIRWORK'}, $filename ) || die "$!"; }
source share