Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
"I000001","dummy","dummy"
when i add a new record i need to add a new id number that is in sequence with the last record entered. So for instance if the last id was 'I000199', the added record would have id 'I000200'.
There is a small problem though, that there are some id numbers randomly missing, so they arent relational to the line num.
I basically need to find the last entry with an id num, remove the 'I', look at the num and increase it by 1 but still keeping it 6 digits long, and attach it to the new entry with an 'I' prefixed in front.
I am using the split function to make each line an array. I was think of maybe using the split function again on the first element, to remove the 'I' (using substr to get the first letter)? That would leave the number but im not sure how to just read the last one so i can increase it.
I guess you can tell im tryin my hardest to avoid using regular expressions! :)
I hope someone can help
Thankya & luvya all, Jenni x.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: increment id num
by Limbic~Region (Chancellor) on Oct 16, 2003 at 15:01 UTC | |
|
Re: increment id num
by CombatSquirrel (Hermit) on Oct 16, 2003 at 15:06 UTC | |
|
Re: increment id num
by Anonymous Monk on Oct 16, 2003 at 15:14 UTC | |
|
Re: increment id num
by hmerrill (Friar) on Oct 16, 2003 at 15:22 UTC | |
|
Re: increment id num
by sunadmn (Curate) on Oct 16, 2003 at 14:58 UTC | |
|
Re: increment id num
by Anonymous Monk on Oct 16, 2003 at 15:43 UTC |