http://qs321.pair.com?node_id=580511


in reply to seeking in hash data structure

You want a query language. Two come to mind:
  1. XPATH. It's used on tree structured data, pretty much as you have here. You'll need to wrap your HoHoHoH as an XML doc to use it.
  2. SQL. Used on table data, but that might suit you pretty well, you just need to model your data properly (i.e. define a 'Company' as a something which has a 'name' and possibly many 'Application's, possibly many 'People').

    Check out the DBD::RAM module if you don't want to mess about with any persistence issues, DBD::SQLite if you don't mind/actually want simple disk storage or MySQL/Postgres if you're that kind of person.

Either way, you'll be defining your underlying types ('Company', 'Application') a little more, which I suspect is the underlying reason you keep running into this issue.

You're make perhaps too much use of the fact that perl doesn't force types down your throat and are hence thinking of everything as a hash rather than an abstract type.

If so, maybe just defining a few struct-type classes will give you places to put your query methods without the need to go to a generalised query language like the above.