in reply to Aaaarghh...hashes of hashes..again :(

Sounds to me like you will be far better off using a small database like sqlite.

You need to separate your data from your business logic - data in tables like "Player", "Game" and "score", where "score" makes the relationship between a player and the game.

This will allow simple to complex queries like "select name, gamescore from player inner join score on score.playerid=player.id order by gamescore descending limit 3" will give you the top 3 players across all games, unless you care to limit that.

IMHO, this problem space is screaming for a database.

     Syntactic sugar causes cancer of the semicolon.        --Alan Perlis

  • Comment on Re: Aaaarghh...hashes of hashes..again :(

Replies are listed 'Best First'.
Re^2: Aaaarghh...hashes of hashes..again :(
by chrestomanci (Priest) on Mar 23, 2011 at 09:29 UTC

    Normally I would agree, and then I would proceed to write a simple app based on DBIx::Class talking to a SQLite database.

    The problem is that databases are harder to understand than simple nested data structures, and if viffer is having trouble understanding a simple hash of hashes, then I think anything database related will be to hard.

    Instead I think we need to point the OP to some tutorials that better explain nested data structures, and answer any questions he may have. Once that is understood we can move onto something more advanced like a database.

      "databases are harder to understand than simple nested data structures"
      I would debate that (subject to the availability of cold beverages).

      In most cases I have encountered, relational databases offer a simpler, more directly-mapped representation of the problem space, when compared to multi-level data structures, especially when it comes to traversing said structures to get summaries. I find OOP is required to approach equivalent simplicity.

      I'm too lazy to substantiate that argument, so I'll just leave it there, and let you have the last word, should you so desire.

      Cheers!

           Syntactic sugar causes cancer of the semicolon.        --Alan Perlis