in reply to File "rename" error in renaming a file.
You are renaming an open file. This is indeed allowed, but in this code, I see no need and would avoid that.rename $tempfile, "tempdir/".$new_filename or die "Cannot rename $tempfile to tempdir/$new_filename" $!";
Update: Also add use strict; use warnings to your code. If you had done that you will see that while ( <$attach> ) produces the error of attempted read on an unopened file handle.
|
|---|