Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: foward/backward within hashes

by BazB (Priest)
on Jan 26, 2004 at 20:42 UTC ( #324268=note: print w/ replies, xml ) Need Help??


in reply to foward/backward within hashes

Create an array of hashrefs, sorted by the time.

Retrieve the next/previous array element as required, dereference the hash and display the information.

Update: Maybe I should explain why: hashes are effectively randomly ordered. By creating the datastructure I suggest, you sort only once, can figure out where in the sort order you are (the current array indice) and can easy retrieve other records with minimal processing (and thought).


If the information in this post is inaccurate, or just plain wrong, don't just downvote - please post explaining what's wrong.
That way everyone learns.


Comment on Re: foward/backward within hashes

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2014-12-19 09:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (75 votes), past polls