Amoe has asked for the wisdom of the Perl Monks concerning the following question:
I have a perl sub that I want to open the directory, read through all the names, select the last one(i.e. the one with the highest number), parse the number off the end and autoincrement it, in order to get a new filename like the ones already there. I've tried reading through all files, sorting them and doing $#files++, but that seems to be rather longwinded and also only worked some of the time (I don't know why, clearly my bad). So can anyone suggest a better way?foo_1.bar foo_2.bar foo_3.bar # and so on...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading directories and parsing standard names
by abstracts (Hermit) on Aug 11, 2001 at 14:07 UTC | |
|
Re: Reading directories and parsing standard names
by Zaxo (Archbishop) on Aug 11, 2001 at 14:18 UTC | |
by Amoe (Friar) on Aug 11, 2001 at 14:53 UTC | |
|
Re: Reading directories and parsing standard names
by George_Sherston (Vicar) on Aug 11, 2001 at 15:13 UTC | |
by Amoe (Friar) on Aug 11, 2001 at 17:37 UTC | |
by koolade (Pilgrim) on Aug 11, 2001 at 20:14 UTC | |
|
Re: Reading directories and parsing standard names
by runrig (Abbot) on Aug 11, 2001 at 18:41 UTC | |
|
Re: Reading directories and parsing standard names
by kjherron (Pilgrim) on Aug 11, 2001 at 21:56 UTC | |
by abstracts (Hermit) on Aug 12, 2001 at 14:06 UTC |