Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Advice - storing data - which structure do you recommend? (details inside)

by Kratimoyporroon (Novice)
on Mar 17, 2002 at 19:53 UTC ( [id://152343]=perlquestion: print w/replies, xml ) Need Help??

Kratimoyporroon has asked for the wisdom of the Perl Monks concerning the following question:

Basically, I have a bunch of data I've gathered from an online forum: name, time, post length, and some other random statistics. I want to be able to sort this data by several different fields. Say, first by time and then by name. What data structure do you recommend, and are there any build in methods to sort this stuff? Could you give a brief example? Thanks.
  • Comment on Advice - storing data - which structure do you recommend? (details inside)

Replies are listed 'Best First'.
Re: Advice - storing data - which structure do you recommend? (details inside)
by tachyon (Chancellor) on Mar 17, 2002 at 20:40 UTC
Re: Advice - storing data - which structure do you recommend? (details inside)
by zengargoyle (Deacon) on Mar 17, 2002 at 20:18 UTC
Re: Advice - storing data - which structure do you recommend? (details inside)
by cyocum (Curate) on Mar 17, 2002 at 22:43 UTC

    If you want to stay within Perl to do this, you could use the Perl sort function. It allows you to write what is basically an anonymous sub to let you sort anyway you want. Of couse, this puts a constraint on your data structure to an array but if all the attributes are always in the same order then it does not make much difference.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-18 04:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found