Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: memory use when merging tied hashrefs

by jcb (Parson)
on Nov 14, 2019 at 23:19 UTC ( [id://11108703]=note: print w/replies, xml ) Need Help??


in reply to Re^2: memory use when merging tied hashrefs
in thread memory use when merging tied hashrefs

You could also "change your lookup code" by using Eily's advice and making a tied hash that encapsulates that search across a list of hashes. This would be extensible for adding more hashes as well, if your database grows more "tables" in the future. If the code only does lookups, you should only need to implement a FETCH method. Something like: (untested; the tied object is an array of hashrefs)

sub FETCH { my $self = shift; my $key = shift; foreach my $hash (@$self) { return $hash->{$key} if exists $hash->{$key} } return undef; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-24 22:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found