Several ways come to mind including hashs or possibly an array. If it doesn't have to stay in memory (I know he said memory.. just exploring options), it's always possible to setup maybe a DBM hash and write/pull off of that (Yes I know it was already mentioned... I'm agreeing with Wiggins basically).
I've written several simple databases using Perl (as many here have I'm sure). It's not all that hard. I'm still new to Perl and I've done it fairly easily. Post code here and maybe we can help. As for learning Perl, I really liked the latest Oreilly "Learning Perl 3rd Edition". I highly recommend it. They have a section on using Arrays and another dealing with Hashes. I also recommend Chapter 16 "Simple Databases". Not memory related there but still good reading. > > > > Hi! > > > > I do not know I am on the right mailing list. > > If not, sorry for the burden. > > > > The advocacy list is not the appropriate list, so I have bcc'd it so it > gets dropped from the discussion. Your question is better asked to the > [EMAIL PROTECTED] list, I have copied it so that it is in the discussion. > > > To say thing briefly: > > I am a programmer for some 25 years using various old and newer languages. > > I have to write some small things in Perl. > > It was fine and fast with some text analysis. > > > > Now I have to write something using an in-memory "database", i.e. a SINGLE > > table filled with records. > > > > I am trying to simply add records then retriev them. > > I already spent more than 20 hours for something which should take 30 > > minutes.... > > > > Seriousely considering making my customer change his mind and revert to > > plain old C++ > > Just to be certain not to miss something simple, I attach a small part > of my > > very, very basic trials. > > > > As you can see when running this small piece of "code", as soon as you > push > > a new record, all records already existing become > > filled with the new pushed record and it is impossible to get any other... > > > > Looks like Perl is not able to handle trivial data structure like an array > > of records (or hashes). > > > > Don't sell Perl short because you have not given it enough time to > learn. The reason this is complicated for you isn't Perl's problem, it > is lack of time taken to learn its fundamentals, I would say the same > things about C++. Whether you have that time or wish to do it is up to > you. Perl can easily handle what you are after using either a Hash of > hashes or an Array of hashes. Perl has references to handle complex > data structures, similar to what you describe. But including lines such > as "shit language perl" in the comments of a script posted to a group on > advocacy for Perl isn't likely to get you very far. I would suggest > reading through, > > perldoc perllol > perldoc perldsc > perldoc perlreftut > perldoc perlref > > Before assuming this trivial task can't be handled by Perl, and/or if > you are still interested repost a better question to the beginners list > explaining what you are attempting to do and why it is failing. You > should also be using 'strict' in all of your code. > > I would have devoted more time to your script had your attitude been > better from the start.... > > http://www.catb.org/~esr/faqs/smart-questions.html > > http://danconia.org > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>