in reply to finding odd characters in a string that I am creating in the script

As per CB, I think this is close to what you want.
#!/usr/bin/perl -w use strict; use File::Copy; my $source_dir = "C:/temp"; my $dest_dir = "C:/temp2"; move_pdf($source_dir, $dest_dir); sub move_pdf { my ($src_path, $dest_path) = @_; opendir (SOURCE_DIR, $src_path) or die "can't open sourcedir"; if (!-e $dest_path) { mkdir $dest_path or die "can't create $dest_path"; } my @pdf2copy = grep{/\.pdf$/} readdir SOURCE_DIR; foreach my $file (@pdf2copy) { copy ( "$src_path/$file", "$dest_path/$file") || die "copy failed $src_path/$file, $dest_path/$file"; } }
Update: I think that "move" instead of "copy" above is right for you.
  • Comment on Re: finding odd characters in a string that I am creating in the script
  • Download Code