> 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?

How's this (attached).

--
  Simon Oliver

#!perl -w
use strict;

my $dir = $ARGV[0] || '.';

opendir DH, $dir 
        or die "Can't open '$dir': $!\n";
my @list = readdir DH;
closedir DH;

my $base = '2000-05-16';
my $index = 0;
foreach (@list) {
        next if -d;     #ignore dirs
        if (/^$base\.(\d+)$/) {
                $index = $1 if ($1>$index);
        }
}
++$index;

my $nextfile = "$base.$index";
open FH , ">$nextfile";
close FH;

---
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]

Reply via email to