"be consistent" | |
PerlMonks |
Re: An odd flat file database questionby eg (Friar) |
on Feb 08, 2001 at 06:46 UTC ( [id://57117]=note: print w/replies, xml ) | Need Help?? |
I've read through this post a couple of times, and I don't quite see what your question is. If you've got a 10k line flat-file, I think it's time for you to consider moving to a more flexible and robust database system. Mysql, PostgreSQL and the venerable Berkeley DB system are popular free (at least as in beer) options for you. You "control number system" is essentially the unique primary key in your database. It's a pretty standard practice. In what way do you find it "cumbersome". If it's a problem with re-keying your database every time you add or remove an item, my advice is don't. When you remove an item, that primary key is gone forever, when you add an item, just increment your max primary key. Save a copy of the max primary key somewhere else so you don't need to run through your entire database to find out what it is. Since your primary query is by catalog number, keep your database sorted by that. (If I've guessed your problem wrong, then I apologize. :) It also sounds like you have a database normalization problem that you'll want to address eventually, but I guess that can wait. Update: sounds like you want to learn how to tie an array ... maybe check out DB_File.
In Section
Seekers of Perl Wisdom
|
|