You could be lazy and (ab)use
File::Temp:
#!/usr/bin/perl
use strict;
use warnings;
use POSIX ();
use File::Temp ();
my $log = File::Temp->new(
UNLINK => 0,
DIR => '/the/path/to/your/log/folder/',
# isn't this too fancy?! you don't need "nice" file names* ;-)
TEMPLATE => POSIX::strftime( 'simplebr_%Y%m%d%H%M%S_XXXX', localti
+me ),
SUFFIX => '.txt',
);
print $log 'foo bar';
close $log;
* I guess your "logs" folder is in fact some kind of (very) poor man's queue.
If this is correct, you don't want to *sort* those files on a file name basis because it would be too slow,
better use whatever your underlying OS offers you for watching a folder (e.g.
Sys::Gamin,
Linux::Inotify,
SGI::FAM,
Win32::ChangeNotify).
Anyway, you'll have to take some solid countermeasures in order to avoid trashing your disk. ;-)