in reply to File::Copy - not working!

I agree that you should be looking at what tmpFileName is doing. I did notice a couple of other things though. First of all you appear to have a typo:

$filname = @filespec[$#filespec];
Should be:
$filename = @filespec[$#filespec];
Secondly, always, always, always check the return value from system calls (0 on success, 1 on failure):
system("cp $tmpfile $copypath/$att_file") && die "Could not cp $tmpfile to $copypath/$att_file - $!\n";
-- vek --