in reply to Re^2: Rename the text file WRT String
in thread Rename the text file WRT String

Thank you for restyling my working code. I'm sure reddevil420 will find your styling helpful. By the way, as far as I'm aware, the behaviour of rename is system dependent, which is why I prefer not to use it.

Replies are listed 'Best First'.
Re^4: Rename the text file WRT String
by Monk::Thomas (Friar) on Jul 24, 2013 at 10:45 UTC

    a) I failed to recognize it wasn't the OP who posted this code. Ahem. Oops.

    b) I'm aware that rename has portability issues, but in this case it's pretty safe to use it because the requirements specify the rename must happen to a file and the file name changes, but not the location. Since we closed the filehandle before, the 'open file' issue does not apply either. Other issues may apply, but this is the OPs responsibility to figure out since we do not know the environment and requirements.

    c) nitpick: Your manual rename didn't since there was no unlinking of the old file. I'm sorry to say that but it was just a very inefficient copy, which may even silently generate garbage output in case the disk space gets exhausted while copying. (The OP didn't give any clue how large the files are.)