Kuhnibert wrote:
> YYYY-MM-DD.<running number>
> e.g.
> 2000-05-16.1
> 2000-05-16.2
> 2000-05-16.3
>
> now i want to create a new file, it's still the 16.05.2000
> and i need the next available suffix (4 for the a.m.
> example), what would be the easiest way to do so?
Perhaps something like this (untested):
opendir DIR, '.' or die "Can't opendir: $!";
my $today = '2000-05-16'; # e.g. generated from localtime()
my $highest = (sort { $b <=> $a }
map { /^\d{4}-\d{2}-\d{2}\.(\d+)$/ && $1 }
grep { /^$today\./o }
readdir DIR)[0]
closedir DIR or die "Can't closedir: $!";
$highest++;
my $filename = "$today.$highest";
Cheers,
Philip
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]