in reply to HoH search question
Similarly a second hash for the 'user' field. If you expect to have a lot of keys for each record, with a little creativity you can build a single index hash which has lookups for all the keys in your data structure. When/If this gets really big you might want to change to using a DB structure - either RDBMS or as I prefer DB_File. You'll probably want to use the B-Tree implementation to store multiple values for a key.my %oslookup; while( my ($pc,$data) = each %hoh ) { push @{ $oslookup{$data->{'os'}} }, $pc; } # later on print "linux pcs are: ", join(',', @{$oslookup{'linux'} || []}, "\n";
|
|---|