Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: DB_file and DB_HASH

by crazyinsomniac (Prior)
on Jun 05, 2002 at 00:08 UTC ( #171680=note: print w/replies, xml ) Need Help??

in reply to DB_file and DB_HASH

visit the DB_File documentation, and then use a BTREE to store your data. A hash is not sorted. A balanced tree is.

Of all the things I've lost, I miss my mind the most.
perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

Replies are listed 'Best First'.
Re: Re: DB_file and DB_HASH
by perrin (Chancellor) on Jun 05, 2002 at 00:14 UTC
    BTREE is faster too, according to a benchmark posted here a while back.
      Thanks but my question is not to get the data in the sorted order but the order in which the data was inserted.For exam if I did 323|Val and 121|Val, I would like to get 323 first.Sorry if I confused.Is there any way to achieve this using BTREE,please advise

        Something like Storable or Freeze/Thaw might do what you want. Check the perldoc

        It sounds more like you're using it as an array then. Maybe you should use the Queue instead.

        If you need both insertion order access and random access by key you will have to store a separate array that keeps track of the order that keys were inserted.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2022-12-06 20:14 GMT
Find Nodes?
    Voting Booth?

    No recent polls found