loody wrote:
Dear all:
I try to update the end of my file index by 1 per day.
ex:
     file_0   -->  file_1
     file_10  --> file_11

I know I can do some stupid things as writing 10 elseifs to determine
right now value and write back it after adding 1.
But is there some faster way to do so?
Like some default functions or modules I can take advantage of?

$ perl -e'
my @x = qw/ file_0 file_10 /;
for ( @x ) {
    print "$_  -->  ";
    s/(\d+)$/$1 + 1/e;
    print "$_\n";
    }
'
file_0  -->  file_1
file_10  -->  file_11



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to