in reply to Re^6: file is not getting copied
in thread file is not getting copied

If it is not working, at least one of your assumptions is wrong. Test them one by one:

# Test if $copy_from exists: -f $copy_from or die "File '$copy_from' does not exist"; # Test if the directory for $copy_to exists: use File::Basename; my $target_dir = dirname($copy_to); -d $target_dir or die "Target directory '$target_dir' does not exist";