in reply to generating unique filenames
Hi all,
besides the different code examples for creating "the next" filename I was wondering why the function should be restricted to filenames with file extension?
Why not allow filenames without file extension?
What is the behaviour with filenames which have two extensions like bundle.tar.gz? In the latter case I would expect only bundle to be incremented but not tar, destroying the meaning of the filename extensions.
What do you think of just using an very old core module: File::Basename?
use File::Basename qw(fileparse); ... my ($word, $path, $ext) = fileparse($filename, qr/\..*/);
and suddenly you would also have the possibility to create "the next" file in relative and absolute file names. Wouldn't that be a valuable generalisation of the API?
Best regards
McA
|
|---|