Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: An odd flat file database question

by 2501 (Pilgrim)
on Feb 08, 2001 at 07:17 UTC ( [id://57125]=note: print w/replies, xml ) Need Help??


in reply to An odd flat file database question

I am a little loopy tonight
are you looking for something like:
while(<catalog>){ print "$_\n" if(/$catnum/ ... /$catnum2/); }

Replies are listed 'Best First'.
Re (tilly) 2 (bug): An odd flat file database question
by tilly (Archbishop) on Feb 08, 2001 at 07:29 UTC
    See Re (tilly) 2: An odd flat file database question for an explanation of the bug in your code. In any case the problem is a data structure issue. Keeping a sorted list may be convenient for spitting data out, but is inconvenient when it comes to inserts and deletes. The simplest answer in this case is to use a BTree with DB_File setting the R_DUP flag on. You cannot get the features you need through the tied interface, but the OO interface gives you the ability to quickly access by catalog ID, insert and delete, and have duplicate entries.

    Of course if the complexity of the problem grows a more sophisticated database would be a better fit...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://57125]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-19 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found